EXHIBIT 5.1 February 3, 2005 AlgoRx Pharmaceuticals, Inc. 500 Plaza Drive, 2nd Floor Secaucus, New Jersey 07094-3619 RE: ALGORX PHARMACEUTICALS, INC. - REGISTRATION STATEMENT ON FORM S-1 Ladies and Gentlemen: We have acted as counsel to AlgoRx Pharmaceuticals, Inc., a Delaware corporation (the "Company"), in connection with the Registration Statement on Form S-1 (Registration No. 333-120757) initially filed with the Securities and Exchange Commission on November 24, 2004 (as may be further amended or supplemented, the "Registration Statement") to register under the Securities Act of 1933, as amended, 7,820,000 shares of the Company's authorized, but unissued common stock, par value $0.001 (the "Shares"). The Shares, which include up to 1,020,000 shares of the Company's common stock issuable pursuant to an over-allotment option granted to the underwriters, are to be sold pursuant to an underwriting agreement to be entered into by and among the Company, Credit Suisse First Boston LLC, Citigroup Global Markets Inc., Piper Jaffray & Co. and Lazard Freres & Co. LLC, as representatives of the underwriters (the "Underwriting Agreement"). This opinion is being furnished in accordance with the requirements of Item 16(a) of Form S-1 and Item 601(b)(5)(i) of Regulation S-K. We have assumed the authenticity of all records, documents and instruments submitted to us as originals, the genuineness of all signatures, the legal capacity of natural persons and the conformity to the originals of all records, documents and instruments submitted to us as photostatic or certified copies. In rendering our opinion, we have examined the following records, documents and instruments: (a) The Certificate of Amendment and Third Amended and Restated Certificate of Incorporation of the Company, filed as exhibits to the Registration Statement; (b) The Amended and Restated Certificate of Incorporation of the Company, filed as an exhibit to the Registration Statement and to be filed with the Secretary of State of Delaware in connection with (but before) the sale of the Shares, and certified to us by an officer of the Company as being the form to be filed with the Delaware Secretary of State in connection with (but before) the sale of the Shares; Heller Ehrman White & McAuliffe LLP 120 West 45th Street, 7th Floor New York, NY 10036 www.hewm.com - -------------------------------------------------------------------------------- NEW YORK San Francisco Silicon Valley Los Angeles San Diego Seattle Portland Anchorage Washington, D.C. Madison, WI Hong Kong Singapore Affiliated Offices: Milan Paris Rome (HELLEREHRMAN ATTORNEYS LOGO) AlgoRx Pharmaceuticals, Inc. February 3, 2005 Page 2 (c) The Bylaws of the Company certified to us by an officer of the Company as being complete and in full effect as of the date of this opinion; (d) The Amended and Restated Bylaws of the Company filed as an exhibit to the Registration Statement and certified to us by an officer of the Company as being the form to be in effect as of the closing date of the sale of the Shares; (e) A certificate of an officer or officers of the Company (the "Officers' Certificate") (i) attaching records certified to us as constituting all records of proceedings and actions of the Board of Directors, including any committee thereof, and stockholders of the Company relating to the Shares and the Registration Statement, and (ii) certifying certain factual matters; (f) the Registration Statement; and (g) a draft of the Underwriting Agreement to be filed as an exhibit to the Registration Statement. We have relied upon the Officers' Certificate with respect to the accuracy of material factual matters contained therein which were not independently established by us. Based on the matters described above, and assuming that (i) the Registration Statement becomes and remains effective during the period when the Shares are offered and sold, (ii) the Underwriting Agreement shall have been executed and delivered by the parties thereto and conforms in all material respects to such draft to be filed as an exhibit to the Registration Statement, (iii) the Shares to be sold are issued, delivered and paid for in accordance with the terms of the Underwriting Agreement, (iv) the appropriate certificates evidencing the Shares will be executed and delivered by the Company, (v) such Amended and Restated Certificate of Incorporation and Amended and Restated Bylaws are in effect as the Company's Certificate of Incorporation and Bylaws at the time of the sale of the Shares, and (vi) all applicable securities laws are complied with, we are of the opinion that, if as and when issued by the Company, the Shares will be legally issued, fully paid and nonassessable. This opinion is limited to the federal law of the United States of America and the General Corporation Law of the State of Delaware, and we disclaim any opinion as to the laws of any other jurisdiction. We further disclaim any opinion as to any other statute, rule, regulation, ordinance, order or other promulgation of any other jurisdiction or any regional or local governmental body or as to any related judicial or administrative opinion. We consent to the filing of this opinion letter as Exhibit 5.1 to the Registration Statement and to the reference to this firm under the caption "Legal Matters" in the prospectus which is part of the Registration Statement. In giving this consent, we do not thereby admit that we are within the category of persons whose consent is required under Section 7 of the Act, the rules and regulations of the Securities and Exchange Commission promulgated thereunder, or Item 509 of Regulation S-K. (HELLEREHRMAN ATTORNEYS LOGO) AlgoRx Pharmaceuticals, Inc. February 3, 2005 Page 3 This opinion letter is rendered as of the date first written above and we disclaim any obligation to advise you of facts, circumstances, events or developments which hereafter may be brought to our attention and which may alter, affect or modify the opinion expressed herein. Our opinion is expressly limited to the matters set forth above and we render no opinion, whether by implication or otherwise, as to any other matters relating to the Company or the Shares. Very truly yours, /s/ Heller Ehrman White & McAuliffe LLP