<?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>0001168475</rptOwnerCik>
            <rptOwnerName>SAFENOWITZ HOWARD B</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O GETTY REALTY CORP</rptOwnerStreet1>
            <rptOwnerStreet2>292 MADISON AVE 9TH FLOOR</rptOwnerStreet2>
            <rptOwnerCity>NEWYORK</rptOwnerCity>
            <rptOwnerState>NY</rptOwnerState>
            <rptOwnerZipCode>10017</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle></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>7000</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>7000</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>70500</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
        <derivativeTransaction>
            <securityTitle>
                <value>Restricted Stock Unit</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F1"/>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2024-03-01</value>
            </transactionDate>
            <deemedExecutionDate>
                <value>2024-03-01</value>
            </deemedExecutionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>M</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>5000</value>
                    <footnoteId id="F4"/>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F2"/>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F2"/>
                <footnoteId id="F4"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>5000</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>65500</value>
                </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 5 years commencing on the 1st anniversary of the grant date, subject to continued service with the Issuer on each vesting date, except that to the extent unvested, RSUs fully vest upon death or upon termination of service for any reason other than the Reporting Person voluntarily electing to resign from the Board, voluntarily electing not to stand for re-election, or being involuntarily removed from the Board (excluding a failure to be re-elected by the stockholders). RSUs may also vest in the discretion of the Compensation Committee upon retirement from the Board, 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 10th anniversary of the grant date (or 10th 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 the Reporting Person for no consideration.</footnote>
        <footnote id="F4">The transaction represents settlement of fully-vested RSUs for cash pursuant to the terms of a 2014 Restricted Stock Unit Agreement.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Howard B. Safenowitz</signatureName>
        <signatureDate>2024-03-01</signatureDate>
    </ownerSignature>
</ownershipDocument>
