1


                                                                     EXHIBIT 5.1

                           GOODWIN, PROCTER & HOAR LLP
                               One Exchange Place
                           Boston, Massachusetts 02109



                                February 3, 2000

UniFirst Corporation
68 Jonspin Road
Wilmington, MA 01887

Re:      Registration Statement On Form S-8
         ----------------------------------

Ladies and Gentlemen:

         This opinion is delivered in our capacity as counsel to UniFirst
Corporation, a Massachusetts corporation (the "Company"), in connection with the
preparation and filing with the Securities and Exchange Commission under the
Securities Act of 1933, as amended (the "Act"), of a Registration Statement on
Form S-8 (the "Registration Statement") relating to 150,000 shares of Common
Stock, par value $0.10 per share (the "Registered Shares"), which the Company
may issue pursuant to the UniFirst Corporation 1996 Stock Incentive Plan (the
"Plan").

         As counsel for the Company, we have examined a copy of the Plan and the
Company's Restated Articles of Incorporation, as amended, and the By-laws, each
as presently in effect, and such records, certificates and other documents of
the Company as we have deemed necessary or appropriate 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 jurisdiction
other than the laws of the United States of America and The Commonwealth of
Massachusetts.

         Based on the foregoing, we are of the opinion that upon the issuance
and delivery of the Registered Shares against payment therefor in accordance
with the terms of the Plan and any agreement thereunder, the Registered Shares
will be legally issued, fully paid and non-assessable shares of the Company's
Common Stock under the Business Corporation Law of The Commonwealth of
Massachusetts.

         The foregoing assumes all requisite steps will be taken to comply with
the requirements of the Act, applicable requirements of state laws regulating
the offer and sale of securities and applicable requirements of the New York
Stock Exchange.

         We hereby consent to being named as counsel to the Company in the
Registration Statement and to the inclusion of this opinion as an exhibit to the
Registration Statement.

                                Very truly yours,

                                /s/ GOODWIN, PROCTER & HOAR LLP

                                GOODWIN, PROCTER & HOAR LLP