<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2024-03-01</periodOfReport>

    <notSubjectToSection16>0</notSubjectToSection16>

    <issuer>
        <issuerCik>0001052752</issuerCik>
        <issuerName>GETTY REALTY CORP /MD/</issuerName>
        <issuerTradingSymbol>GTY</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001607891</rptOwnerCik>
            <rptOwnerName>OLEAR MARK JAMES</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O GETTY REALTY CORP.</rptOwnerStreet1>
            <rptOwnerStreet2>292 MADISON AVE, 9TH FLOOR</rptOwnerStreet2>
            <rptOwnerCity>NEW YORK</rptOwnerCity>
            <rptOwnerState>NY</rptOwnerState>
            <rptOwnerZipCode>10017</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>EVP &amp; Chief Operating Ofc</officerTitle>
            <otherText></otherText>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Restricted Stock Unit</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F1"/>
                <footnoteId id="F2"/>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2024-03-01</value>
            </transactionDate>
            <deemedExecutionDate>
                <value>2024-03-01</value>
            </deemedExecutionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>30000</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F2"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F2"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>30000</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>186650</value>
                    <footnoteId id="F4"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">Each Restricted Stock Unit (RSU) is settled at the discretion of the Compensation Committee in one share of common stock or in cash in an amount equal to the fair market value of one share of common stock on the settlement date noted in footnote (2) below.</footnote>
        <footnote id="F2">RSUs vest ratably over five years commencing on the first anniversary of the date of grant, subject to continued service with the Issuer on each respective vesting date, except that, to the extent unvested, RSUs fully vest upon termination of service without cause or death. RSUs may also vest in the discretion of the Compensation Committee upon retirement from employment, subject to the terms of the Issuer's third Amended and Restated 2004 Omnibus Incentive Compensation Plan and the applicable grant agreement. RSUs are settled in cash or common stock, in the discretion of the Compensation Committee, upon the earlier of the tenth anniversary of the grant date (or the tenth anniversary of the first vesting date for RSUs granted in 2016-2018), or termination of service.</footnote>
        <footnote id="F3">The RSUs were received by reporting person for no consideration.</footnote>
        <footnote id="F4">The &quot;Number of Derivative Securities Beneficially Owned Following Reported Transactions&quot; has been updated by 2,000 RSUs to correct an error on a previous Form 4 regarding total RSUs held following the reported transaction. This adjustment is made despite the accurate reporting in such previous Form 4 of the &quot;Number of Derivative Securities Acquired&quot;.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Mark J. Olear</signatureName>
        <signatureDate>2024-03-01</signatureDate>
    </ownerSignature>
</ownershipDocument>
