Exhibit 23.1
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We consent to the incorporation by reference in the following Registration Statements:
of our reports dated October 25, 2023, with respect to the consolidated financial statements and schedule of UniFirst Corporation and subsidiaries, and the effectiveness of internal control over financial reporting of UniFirst Corporation and subsidiaries, included in this Annual Report (Form 10-K) of UniFirst Corporation for the year ended August 26, 2023.
/s/ Ernst & Young LLP
Boston, Massachusetts
October 25, 2023