Exhibit 5.1 Opinion of Whiteford, Taylor & Preston L.L.P. WHITEFORD, TAYLOR & PRESTON L.L.P. SEVEN SAINT PAUL STREET BALTIMORE, MARYLAND 21202-1626 410 347-8700 FAX 410 347-9478 www.wtplaw.com 210 WEST PENNSYLVANIA AVENUE 1025 CONNECTICUT AVENUE, NW TOWSON, MARYLAND 21204-4515 WASHINGTON, D.C. 20036-5405 TELEPHONE 410 832-2000 TELEPHONE 202 659-6800 FAX 410 832-2015 FAX 202 331-0573 ----- ----- 30 COLUMBIA CORPORATE CENTER 1317 KING STREET 10440 LITTLE PATUXENT PARKWAY ALEXANDRIA, VIRGINIA 22314-2928 COLUMBIA, MARYLAND 21044 TELEPHONE 703 836-5742 TELEPHONE 410 884-0700 FAX 703 836-0265 FAX 410 884-0719 ----- December 5, 1997 Board of Directors CSX Corporation One James Center 901 E. Carey Street Richmond, VA 23219 Re: Post Effective Amendment No. 2 to Registration Statement on Form S-3 Gentlemen: We have acted as counsel to CSX Corporation, a Virginia corporation (the "Corporation"), in connection with a Registration Statement on Form S-3 (the "Registration Statement") filed by the Corporation under the Securities Act of 1933, as amended (the "Act"), with respect to 4,679,811 shares of the common stock of the Corporation, par value $.01 per share (the "Stock") which may be issued and sold under the Corporation's Direct Stock Investment Plan (the "Plan"). In that capacity, we have reviewed the Articles of Incorporation and Bylaws of the Corporation, as amended, the Registration Statement, the corporate action taken by the Corporation adopting the Plan and providing for the registration of the distribution of the Stock, and such other materials and matters as we have deemed necessary for the issuance of this opinion. Based upon the foregoing, we are of the opinion that the Stock has been duly authorized and, upon issuance under the terms set forth in the Registration Statement and the Plan and the receipt of the consideration therefor, will be validly issued, fully paid and nonassessable. We consent to the filing of this opinion as an exhibit to the Registration Statement. In giving this consent, we do not admit that we are within the category of persons whose consent is required by Section 7 of the Act. Very truly yours, Whiteford, Taylor & Preston L.L.P.