EXHIBIT 5.1 Opinion of Whiteford, Taylor & Preston L.L.P. (contains Consent of Counsel) WHITEFORD, TAYLOR & PRESTON L.L.P. SEVEN SAINT PAUL STREET BALTIMORE, MARYLAND 21202-1626 410 347-8700 FAX 410 347-8731 210 WEST PENNSYLVANIA AVENUE TOWSON, MARYLAND 21204-4515 TELEPHONE 410 832-2000 FAX 410 832-2015 ----- 30 COLUMBIA CORPORATE CENTER 10440 LITTLE PATUXENT PARKWAY COLUMBIA, MARYLAND 21044 TELEPHONE 410 884-0700 FAX 410-884-0719 ----- 1025 CONNECTICUT AVENUE, NW WASHINGTON, D.C. 20036-5405 TELEPHONE 202 659-6800 FAX 202 331-0573 ----- 1317 KING STREET ALEXANDRIA, VIRGINIA 22314-2928 TELEPHONE 703 836-5742 FAX 703 836-0265 May 9, 1997 Board of Directors HCIA Inc. 300 East Lombard Street Baltimore, Maryland 21202 Re: Registration Statement on Form S-8 Gentlemen: We have acted as counsel to HCIA Inc., a Maryland corporation (the "Corporation"), in connection with the filing of Post-Effective Amendment No. 1 to the Registration Statement on Form S-8 by the Corporation under the Securities Act of 1933, as amended (the "Registration Statement"), which Registration Statement registers the distribution of an additional: (i) 1,900,000 shares of common stock of the Corporation, par value $.01 per share ("Common Stock"), reserved for issuance to eligible employees of the Corporation pursuant to the HCIA Inc. 1994 Stock and Incentive Plan, as amended; and (ii) 100,000 shares of Common Stock reserved for issuance to non-employee directors of the Corporation pursuant to the HCIA Inc. 1995 Non-Employee Directors Stock Option Plan, as amended (collectively, the "Plans"). In that capacity, we have reviewed the Articles of Incorporation and Bylaws of the Corporation, both as amended to date, the Registration Statement, the Plans, the originals or copies of corporate records reflecting the corporate action taken by the Corporation and its stockholders in connection with the approval of the Plans and amendments thereto and the issuance of the Common Stock under the Plans and such other instruments as we have deemed necessary for the issuance of this opinion. Based upon the foregoing, we are of the opinion that the Common Stock to be offered under the Plans has been duly authorized by all requisite action on the part of the Corporation and, when issued in accordance with the terms and conditions of the Plans, will be legally issued, fully paid and non-assessable. 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 Board of Directors HCIA Inc. May 9, 1997 Page 2 persons whose consent is required by Section 7 of the Securities Act of 1933, as amended. Very truly yours, Whiteford, Taylor & Preston L.L.P.