1 EXHIBIT 5.1 June 30, 1995 UniFirst Corporation 68 Jonspin Road Wilmington, Massachusetts 01887 Re: UniFirst Corporation Profit Sharing Plan Ladies and Gentlemen: This opinion is furnished in connection with the registration pursuant to the Securities Act of 1933, as amended (the "Act"), of 500,000 shares (the "Shares") of Common Stock, par value $.10 per share (the "Common Stock"), of UniFirst Corporation (the "Company") which may be acquired by eligible employees of the Company and certain of its affiliates under the provisions of the UniFirst Corporation Profit Sharing Plan (the "Plan") and of interests in the Plan. We have acted as counsel to the Company in connection with the registration of the Shares and interests in the Plan under the Act. We have examined the Restated Articles of Organization, as amended, and the By-laws, as amended, of the Company; such records of the corporate proceedings of the Company as we deemed necessary; a Registration Statement on Form S-8 under the Act relating to the Shares (the "Registration Statement"); the Plan; and such other certificates, receipts, records and documents as we considered necessary for the purposes of this opinion. We are attorneys admitted to practice in the Commonwealth of Massachusetts. We express no opinion concerning the laws of any jurisdictions other than the laws of the United States of America and the Commonwealth of Massachusetts. Based upon the foregoing, we are of the opinion that when the Shares have been issued and paid for in accordance with the terms of the Plan, the Shares will be validly issued, fully paid and non-assessable shares of the Company's Common Stock. The foregoing assumes that all requisite steps will be taken to comply with the requirements of the Act and applicable requirements of state laws regulating the offer and sale of securities. 2 We hereby consent to the filing of this opinion as an exhibit to the above-referenced Registration Statement. Very truly yours, /s/ Goodwin, Procter & Hoar --------------------------- GOODWIN, PROCTER & HOAR