<?xml version='1.0' encoding='utf-8'?>
<FilingSummary>
  <Version>3.24.2</Version>
  <ProcessingTime/>
  <ReportFormat>html</ReportFormat>
  <ContextCount>265</ContextCount>
  <ElementCount>348</ElementCount>
  <EntityCount>1</EntityCount>
  <FootnotesReported>true</FootnotesReported>
  <SegmentCount>102</SegmentCount>
  <ScenarioCount>0</ScenarioCount>
  <TuplesReported>false</TuplesReported>
  <UnitCount>11</UnitCount>
  <MyReports>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R1.htm</HtmlFileName>
      <LongName>100000 - Document - Document and Entity Information</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DocumentDocumentAndEntityInformation</Role>
      <ShortName>Document and Entity Information</ShortName>
      <MenuCategory>Cover</MenuCategory>
      <Position>1</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R2.htm</HtmlFileName>
      <LongName>100010 - Statement - Consolidated Balance Sheets (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_StatementConsolidatedBalanceSheetsUnaudited</Role>
      <ShortName>Consolidated Balance Sheets (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>2</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R3.htm</HtmlFileName>
      <LongName>100020 - Statement - Consolidated Balance Sheets (Unaudited) (Parenthetical)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_StatementConsolidatedBalanceSheetsUnauditedParenthetical</Role>
      <ShortName>Consolidated Balance Sheets (Unaudited) (Parenthetical)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>3</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R4.htm</HtmlFileName>
      <LongName>100040 - Statement - Consolidated Statements of Operations (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_StatementConsolidatedStatementsOfOperationsUnaudited</Role>
      <ShortName>Consolidated Statements of Operations (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>4</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R5.htm</HtmlFileName>
      <LongName>100050 - Statement - Consolidated Statements of Cash Flows (Unaudited)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_StatementConsolidatedStatementsOfCashFlowsUnaudited</Role>
      <ShortName>Consolidated Statements of Cash Flows (Unaudited)</ShortName>
      <MenuCategory>Statements</MenuCategory>
      <Position>5</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R6.htm</HtmlFileName>
      <LongName>100060 - Disclosure - Description of Business</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDescriptionOfBusiness</Role>
      <ShortName>Description of Business</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>6</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R7.htm</HtmlFileName>
      <LongName>100070 - Disclosure - Accounting Policies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAccountingPolicies</Role>
      <ShortName>Accounting Policies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>7</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R8.htm</HtmlFileName>
      <LongName>100080 - Disclosure - Leases</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeases</Role>
      <ShortName>Leases</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>8</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R9.htm</HtmlFileName>
      <LongName>100090 - Disclosure - Commitments and Contingencies</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureCommitmentsAndContingencies</Role>
      <ShortName>Commitments and Contingencies</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>9</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R10.htm</HtmlFileName>
      <LongName>100100 - Disclosure - Debt</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebt</Role>
      <ShortName>Debt</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>10</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R11.htm</HtmlFileName>
      <LongName>100110 - Disclosure - Derivative instruments</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstruments</Role>
      <ShortName>Derivative instruments</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>11</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R12.htm</HtmlFileName>
      <LongName>100120 - Disclosure - Environmental Obligations</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEnvironmentalObligations</Role>
      <ShortName>Environmental Obligations</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>12</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R13.htm</HtmlFileName>
      <LongName>100130 - Disclosure - Stockholders' Equity</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquity</Role>
      <ShortName>Stockholders' Equity</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>13</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R14.htm</HtmlFileName>
      <LongName>100140 - Disclosure - Earnings Per Common Share</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEarningsPerCommonShare</Role>
      <ShortName>Earnings Per Common Share</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>14</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R15.htm</HtmlFileName>
      <LongName>100150 - Disclosure - Fair Value Measurements</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureFairValueMeasurements</Role>
      <ShortName>Fair Value Measurements</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>15</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R16.htm</HtmlFileName>
      <LongName>100160 - Disclosure - Assets Held For Sale</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAssetsHeldForSale</Role>
      <ShortName>Assets Held For Sale</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>16</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R17.htm</HtmlFileName>
      <LongName>100170 - Disclosure - Property Acquisitions</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosurePropertyAcquisitions</Role>
      <ShortName>Property Acquisitions</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>17</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R18.htm</HtmlFileName>
      <LongName>100180 - Disclosure - Subsequent Events</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureSubsequentEvents</Role>
      <ShortName>Subsequent Events</ShortName>
      <MenuCategory>Notes</MenuCategory>
      <Position>18</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R19.htm</HtmlFileName>
      <LongName>100190 - Disclosure - Accounting Policies (Policies)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAccountingPoliciesPolicies</Role>
      <ShortName>Accounting Policies (Policies)</ShortName>
      <MenuCategory>Policies</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAccountingPolicies</ParentRole>
      <Position>19</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R20.htm</HtmlFileName>
      <LongName>100200 - Disclosure - Leases (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesTables</Role>
      <ShortName>Leases (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeases</ParentRole>
      <Position>20</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R21.htm</HtmlFileName>
      <LongName>100210 - Disclosure - Debt (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtTables</Role>
      <ShortName>Debt (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebt</ParentRole>
      <Position>21</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R22.htm</HtmlFileName>
      <LongName>100220 - Disclosure - Derivative instruments (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstrumentsTables</Role>
      <ShortName>Derivative instruments (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstruments</ParentRole>
      <Position>22</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R23.htm</HtmlFileName>
      <LongName>100230 - Disclosure - Stockholders' Equity (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquityTables</Role>
      <ShortName>Stockholders' Equity (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquity</ParentRole>
      <Position>23</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R24.htm</HtmlFileName>
      <LongName>100240 - Disclosure - Earnings Per Common Share (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEarningsPerCommonShareTables</Role>
      <ShortName>Earnings Per Common Share (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEarningsPerCommonShare</ParentRole>
      <Position>24</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R25.htm</HtmlFileName>
      <LongName>100250 - Disclosure - Fair Value Measurements (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureFairValueMeasurementsTables</Role>
      <ShortName>Fair Value Measurements (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureFairValueMeasurements</ParentRole>
      <Position>25</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R26.htm</HtmlFileName>
      <LongName>100260 - Disclosure - Assets Held For Sale (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAssetsHeldForSaleTables</Role>
      <ShortName>Assets Held For Sale (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAssetsHeldForSale</ParentRole>
      <Position>26</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R27.htm</HtmlFileName>
      <LongName>100270 - Disclosure - Property Acquisitions (Tables)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosurePropertyAcquisitionsTables</Role>
      <ShortName>Property Acquisitions (Tables)</ShortName>
      <MenuCategory>Tables</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosurePropertyAcquisitions</ParentRole>
      <Position>27</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R28.htm</HtmlFileName>
      <LongName>100280 - Disclosure - Description of Business - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDescriptionOfBusinessAdditionalInformationDetail</Role>
      <ShortName>Description of Business - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>28</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R29.htm</HtmlFileName>
      <LongName>100290 - Disclosure - Accounting Policies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAccountingPoliciesAdditionalInformationDetail</Role>
      <ShortName>Accounting Policies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>29</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R30.htm</HtmlFileName>
      <LongName>100300 - Disclosure - Leases - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesAdditionalInformationDetail</Role>
      <ShortName>Leases - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>30</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R31.htm</HtmlFileName>
      <LongName>100310 - Disclosure - Leases - Schedule of Components of Investment in Direct Financing Leases, Net (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureLeasesScheduleOfComponentsOfInvestmentInDirectFinancingLeasesNetDetail</Role>
      <ShortName>Leases - Schedule of Components of Investment in Direct Financing Leases, Net (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>31</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R32.htm</HtmlFileName>
      <LongName>100320 - Disclosure - Leases - Future Contractual Annual Rentals Receivable (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesFutureContractualAnnualRentalsReceivableDetail</Role>
      <ShortName>Leases - Future Contractual Annual Rentals Receivable (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>32</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R33.htm</HtmlFileName>
      <LongName>100330 - Disclosure - Leases - Schedule of Lease-related Assets and Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesScheduleOfLeaseRelatedAssetsAndLiabilitiesDetail</Role>
      <ShortName>Leases - Schedule of Lease-related Assets and Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>33</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R34.htm</HtmlFileName>
      <LongName>100340 - Disclosure - Leases - Summary of Weighted-average Remaining Lease Terms and Discount Rates (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesSummaryOfWeightedAverageRemainingLeaseTermsAndDiscountRatesDetail</Role>
      <ShortName>Leases - Summary of Weighted-average Remaining Lease Terms and Discount Rates (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>34</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R35.htm</HtmlFileName>
      <LongName>100350 - Disclosure - Leases - Schedule of Information Related to Lease Costs for Finance and Operating Leases (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesScheduleOfInformationRelatedToLeaseCostsForFinanceAndOperatingLeasesDetail</Role>
      <ShortName>Leases - Schedule of Information Related to Lease Costs for Finance and Operating Leases (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>35</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R36.htm</HtmlFileName>
      <LongName>100370 - Disclosure - Leases - Schedule of Supplemental Cash Flow Information Related to Leases (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesScheduleOfSupplementalCashFlowInformationRelatedToLeasesDetail</Role>
      <ShortName>Leases - Schedule of Supplemental Cash Flow Information Related to Leases (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>36</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R37.htm</HtmlFileName>
      <LongName>100380 - Disclosure - Leases - Schedule of Reconciles the Undiscounted Cash Flows for Direct Financing Lease Liabilities and Operating Lease Liabilities (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesScheduleOfReconcilesUndiscountedCashFlowsForDirectFinancingLeaseLiabilitiesAndOperatingLeaseLiabilitiesDetail</Role>
      <ShortName>Leases - Schedule of Reconciles the Undiscounted Cash Flows for Direct Financing Lease Liabilities and Operating Lease Liabilities (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>37</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R38.htm</HtmlFileName>
      <LongName>100390 - Disclosure - Leases - Schedule of Significant Tenants by Revenue (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureLeasesScheduleOfSignificantTenantsByRevenueDetail</Role>
      <ShortName>Leases - Schedule of Significant Tenants by Revenue (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>38</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R39.htm</HtmlFileName>
      <LongName>100400 - Disclosure - Leases - Getty Petroleum Marketing Inc. - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureLeasesGettyPetroleumMarketingIncAdditionalInformationDetail</Role>
      <ShortName>Leases - Getty Petroleum Marketing Inc. - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>39</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R40.htm</HtmlFileName>
      <LongName>100410 - Disclosure - Commitments and Contingencies - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureCommitmentsAndContingenciesAdditionalInformationDetail</Role>
      <ShortName>Commitments and Contingencies - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>40</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R41.htm</HtmlFileName>
      <LongName>100420 - Disclosure - Debt - Schedule of Maturity Amounts Outstanding Under Credit Agreement and Senior Unsecured Notes (Detail)</LongName>
      <ReportType>Notes</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtScheduleOfMaturityAmountsOutstandingUnderCreditAgreementAndSeniorUnsecuredNotesDetail</Role>
      <ShortName>Debt - Schedule of Maturity Amounts Outstanding Under Credit Agreement and Senior Unsecured Notes (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>41</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R42.htm</HtmlFileName>
      <LongName>100430 - Disclosure - Debt - Schedule of Maturity Amounts Outstanding Under Credit Agreement and Senior Unsecured Notes (Parenthetical) (Detail)</LongName>
      <ReportType>Notes</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtScheduleOfMaturityAmountsOutstandingUnderCreditAgreementAndSeniorUnsecuredNotesParentheticalDetail</Role>
      <ShortName>Debt - Schedule of Maturity Amounts Outstanding Under Credit Agreement and Senior Unsecured Notes (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>42</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R43.htm</HtmlFileName>
      <LongName>100440 - Disclosure - Debt - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtAdditionalInformationDetail</Role>
      <ShortName>Debt - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>43</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R44.htm</HtmlFileName>
      <LongName>100450 - Disclosure - Debt - Summary of Scheduled Debt Maturities, Including Balloon Payments (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtSummaryOfScheduledDebtMaturitiesIncludingBalloonPaymentsDetail</Role>
      <ShortName>Debt - Summary of Scheduled Debt Maturities, Including Balloon Payments (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>44</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R45.htm</HtmlFileName>
      <LongName>100460 - Disclosure - Debt - Summary of Scheduled Debt Maturities, Including Balloon Payments (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureDebtSummaryOfScheduledDebtMaturitiesIncludingBalloonPaymentsParentheticalDetail</Role>
      <ShortName>Debt - Summary of Scheduled Debt Maturities, Including Balloon Payments (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>45</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R46.htm</HtmlFileName>
      <LongName>100470 - Disclosure - Derivative instruments (Additional Information) (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstrumentsAdditionalInformationDetails</Role>
      <ShortName>Derivative instruments (Additional Information) (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <ParentRole>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstrumentsTables</ParentRole>
      <Position>46</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R47.htm</HtmlFileName>
      <LongName>100480 - Disclosure - Derivative instruments - Summary of Derivative Instruments Included In Consolidated Balance sheet (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstrumentsSummaryOfDerivativeInstrumentsIncludedInConsolidatedBalanceSheetDetails</Role>
      <ShortName>Derivative instruments - Summary of Derivative Instruments Included In Consolidated Balance sheet (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>47</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R48.htm</HtmlFileName>
      <LongName>100490 - Disclosure - Derivative Instruments - Summary of Amounts Recorded to Accumulated Other Comprehensive (Loss) Related to Derivative and Hedging Activities (Details)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosureDerivativeInstrumentsSummaryOfAmountsRecordedToAccumulatedOtherComprehensiveLossRelatedToDerivativeAndHedgingActivitiesDetails</Role>
      <ShortName>Derivative Instruments - Summary of Amounts Recorded to Accumulated Other Comprehensive (Loss) Related to Derivative and Hedging Activities (Details)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>48</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R49.htm</HtmlFileName>
      <LongName>100500 - Disclosure - Environmental Obligations - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEnvironmentalObligationsAdditionalInformationDetail</Role>
      <ShortName>Environmental Obligations - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>49</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R50.htm</HtmlFileName>
      <LongName>100510 - Disclosure - Stockholders' Equity - Summary of Changes in Stockholders' Equity (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquitySummaryOfChangesInStockholdersEquityDetail</Role>
      <ShortName>Stockholders' Equity - Summary of Changes in Stockholders' Equity (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>50</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R51.htm</HtmlFileName>
      <LongName>100520 - Disclosure - Stockholders' Equity - Summary of Changes in Stockholders' Equity (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquitySummaryOfChangesInStockholdersEquityParentheticalDetail</Role>
      <ShortName>Stockholders' Equity - Summary of Changes in Stockholders' Equity (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>51</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R52.htm</HtmlFileName>
      <LongName>100530 - Disclosure - Stockholders' Equity - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureStockholdersEquityAdditionalInformationDetail</Role>
      <ShortName>Stockholders' Equity - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>52</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R53.htm</HtmlFileName>
      <LongName>100540 - Disclosure - Earnings Per Common Share - Computation of Basic and Diluted Earnings Per Common Share (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureEarningsPerCommonShareComputationOfBasicAndDilutedEarningsPerCommonShareDetail</Role>
      <ShortName>Earnings Per Common Share - Computation of Basic and Diluted Earnings Per Common Share (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>53</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R54.htm</HtmlFileName>
      <LongName>100550 - Disclosure - Fair Value Measurements - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureFairValueMeasurementsAdditionalInformationDetail</Role>
      <ShortName>Fair Value Measurements - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>54</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R55.htm</HtmlFileName>
      <LongName>100560 - Disclosure - Fair Value Measurements - Schedule of Assets and Liabilities Measured at Fair Value on Recurring Basis (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureFairValueMeasurementsScheduleOfAssetsAndLiabilitiesMeasuredAtFairValueOnRecurringBasisDetail</Role>
      <ShortName>Fair Value Measurements - Schedule of Assets and Liabilities Measured at Fair Value on Recurring Basis (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>55</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R56.htm</HtmlFileName>
      <LongName>100570 - Disclosure - Assets Held For Sale - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAssetsHeldForSaleAdditionalInformationDetail</Role>
      <ShortName>Assets Held For Sale - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>56</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R57.htm</HtmlFileName>
      <LongName>100580 - Disclosure - Assets Held For Sale - Summary of Real Estate Held for Sale (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosureAssetsHeldForSaleSummaryOfRealEstateHeldForSaleDetail</Role>
      <ShortName>Assets Held For Sale - Summary of Real Estate Held for Sale (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>57</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R58.htm</HtmlFileName>
      <LongName>100590 - Disclosure - Property Acquisitions - Additional Information (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/Role_DisclosurePropertyAcquisitionsAdditionalInformationDetail</Role>
      <ShortName>Property Acquisitions - Additional Information (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>58</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R59.htm</HtmlFileName>
      <LongName>100600 - Disclosure - Property Acquisitions - Summary of Purchase Price Allocation (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosurePropertyAcquisitionsSummaryOfPurchasePriceAllocationDetail</Role>
      <ShortName>Property Acquisitions - Summary of Purchase Price Allocation (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>59</Position>
    </Report>
    <Report instance="gty-20240630.htm">
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <HtmlFileName>R60.htm</HtmlFileName>
      <LongName>100610 - Disclosure - Property Acquisitions - Summary of Purchase Price Allocation (Parenthetical) (Detail)</LongName>
      <ReportType>Sheet</ReportType>
      <Role>http://www.gettyrealty.com/20240630/taxonomy/role/DisclosurePropertyAcquisitionsSummaryOfPurchasePriceAllocationParentheticalDetail</Role>
      <ShortName>Property Acquisitions - Summary of Purchase Price Allocation (Parenthetical) (Detail)</ShortName>
      <MenuCategory>Details</MenuCategory>
      <Position>60</Position>
    </Report>
    <Report>
      <IsDefault>false</IsDefault>
      <HasEmbeddedReports>false</HasEmbeddedReports>
      <LongName>All Reports</LongName>
      <ReportType>Book</ReportType>
      <ShortName>All Reports</ShortName>
    </Report>
  </MyReports>
  <InputFiles>
    <File doctype="10-Q" isDefinitelyFs="true" isUsgaap="true" original="gty-20240630.htm">gty-20240630.htm</File>
    <File>gty-20240630.xsd</File>
  </InputFiles>
  <SupplementalFiles/>
  <BaseTaxonomies>
    <BaseTaxonomy items="1">http://fasb.org/srt/2024</BaseTaxonomy>
    <BaseTaxonomy items="734">http://fasb.org/us-gaap/2024</BaseTaxonomy>
    <BaseTaxonomy items="30">http://xbrl.sec.gov/dei/2024</BaseTaxonomy>
  </BaseTaxonomies>
  <HasPresentationLinkbase>false</HasPresentationLinkbase>
  <HasCalculationLinkbase>false</HasCalculationLinkbase>
</FilingSummary>
