EXHIBIT 23. CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We hereby consent to the incorporation by reference in the Registration Statement on Form S-8 (Nos. 333-115672, 333-45249 and 333-45251),
Form S-3 (No. 333-200913) and Form S-3D (No. 333-114730) of Getty Realty Corp. of our report dated March 10, 2016 relating to the financial statements and the effectiveness of internal control over financial reporting, which
appears in the Annual Report to Shareholders, which is incorporated in this Annual Report on Form 10-K. We also consent to the incorporation by reference of our report dated March 10, 2016 relating
to the financial statement schedules, which appears in this Form 10-K.
/s/ PricewaterhouseCoopers LLP
New York, New York
March 10, 2016