Exhibit 23.1 CONSENT OF ERNST & YOUNG LLP, INDEPENDENT AUDITORS We consent to the incorporation by reference in the Registration Statements of Form S-8 (File Nos. 33-60781, 333-96097, and 333-82682) of UniFirst Corporation of our reports dated November 4, 2003, with respect to the consolidated financial statements and schedule of UniFirst Corporation included in this Annual Report (Form 10-K) for the year ended August 30, 2003. /s/ Ernst & Young LLP Boston, Massachusetts November 25, 2003