real-estate Audience: general 6 min read

Capital Gains Tax on Real Estate: How to Calculate and Minimize Your Tax

How capital gains tax applies to real estate sales. Covers the Section 121 exclusion, depreciation recapture, 1031 exchanges, and examples.

Capital gain tax on real estate is 0%, 15%, or 20% for properties held longer than one year, depending on your taxable income. Depreciation recapture on rental property is taxed at a flat 25%. Primary home sellers can exclude up to $250,000 ($500,000 MFJ) of gain. Below, we walk through the full calculation, rate tables, and seven strategies to reduce or defer the tax.

Key Takeaways

  • Primary residence sellers can exclude up to $250,000 (single) or $500,000 (MFJ) of gain.
  • Long-term real estate gains are taxed at 0%, 15%, or 20% plus a potential 3.8% NIIT.
  • Depreciation recapture on rental property is taxed at a flat 25% rate.
  • 1031 like-kind exchanges defer capital gains tax on investment properties indefinitely.
  • Your adjusted basis — not just the purchase price — determines your taxable gain.

How to Calculate Capital Gains on Real Estate

The formula is straightforward, but the details matter:

Taxable Gain = Sale Price - Selling Expenses - Adjusted Basis - Exclusions

Adjusted Basis

Your basis starts as the purchase price and is adjusted over time:

Increases to basis (reduces gain):

  • Closing costs at purchase (title insurance, attorney fees, recording fees)
  • Capital improvements (new roof, kitchen renovation, additions, HVAC replacement)
  • Special assessments for local improvements

Decreases to basis (increases gain):

  • Depreciation taken or allowed on rental/business use
  • Casualty loss deductions claimed
  • Certain energy credits received

Routine maintenance and repairs do not increase your basis.

Worked Example: Selling a Rental Property

ItemAmount
Sale price$550,000
Selling expenses (agent, closing)-$33,000
Net sale price$517,000
Original purchase price$300,000
Closing costs at purchase+$7,000
Capital improvements (new roof, HVAC)+$35,000
Depreciation claimed over 8 years-$72,000
Adjusted basis$270,000
Total gain$247,000
Depreciation recapture ($72,000 at 25%)$18,000
Remaining gain ($175,000 at 15% LTCG)$26,250
Total federal tax$44,250

Capital Gains Tax Rates on Real Estate

Real estate gains follow the same rate structure as other capital gains:

Holding Period Tax Rate Notes
Short-term (1 year or less) 10% - 37% Taxed as ordinary income at your marginal rate
Long-term (more than 1 year) 0%, 15%, or 20% Rate depends on taxable income
Depreciation recapture 25% (flat) Applies to depreciation claimed on rental/business property
Net Investment Income Tax 3.8% Applies if MAGI exceeds $200k (single) / $250k (MFJ)

For the full breakdown of 2025 and 2026 long-term capital gains brackets, see our capital gains tax rates guide.

Primary Residence: The Section 121 Exclusion

The most powerful real estate tax break is the Section 121 exclusion. If you sell your primary home, you can exclude:

  • $250,000 of gain (Single, Head of Household)
  • $500,000 of gain (Married Filing Jointly)

Requirements

  1. Ownership test: You owned the home for at least 2 of the 5 years before the sale.
  2. Use test: You lived in the home as your primary residence for at least 2 of the 5 years.
  3. Frequency test: You have not used the exclusion in the past 2 years.

Most homeowners pay zero capital gains tax on their home sale thanks to this exclusion. If your gain exceeds the exclusion amount, only the excess is taxed at long-term capital gains rates.

Rental and Investment Property

Investment properties do not qualify for the Section 121 exclusion, so the full gain is taxable. Two additional rules apply:

Depreciation Recapture

The IRS requires rental property owners to depreciate the building over 27.5 years (residential) or 39 years (commercial). When you sell, all depreciation claimed — or that you were allowed to claim — is “recaptured” and taxed at a flat 25% rate, even if your ordinary income bracket is lower.

1031 Like-Kind Exchange

A 1031 exchange allows you to defer capital gains tax entirely by reinvesting the proceeds into a replacement investment property. Key rules:

  • The replacement property must be “like-kind” (any real property for real property within the U.S.)
  • You must identify the replacement within 45 days and close within 180 days
  • You must use a qualified intermediary to hold the funds
  • The exchange defers the tax — it does not eliminate it (though you can keep exchanging until death, when heirs receive a stepped-up basis)

Strategies to Minimize Capital Gains Tax on Real Estate

  1. Use the Section 121 exclusion. If you can meet the 2-year ownership and use test, this is the single most valuable strategy. See the full rules in our home sale tax guide.

  2. 1031 exchange for investment property. Defer the entire gain into a replacement property. Some investors chain 1031 exchanges for decades.

  3. Installment sale. Spread the gain over multiple tax years by receiving payments over time. This can keep you in a lower tax bracket each year.

  4. Offset gains with losses. Use tax loss harvesting from your investment portfolio to offset taxable real estate gains dollar for dollar.

  5. Opportunity Zone investment. Reinvesting capital gains into a Qualified Opportunity Zone fund can defer and partially reduce the tax. See our Opportunity Zones guide.

  6. Track every capital improvement. Keep receipts for renovations, additions, and system replacements. Every dollar of improvement increases your basis and reduces your taxable gain.

  7. Time the sale for a low-income year. If your income drops (retirement, sabbatical, job change), you may fall into the 0% long-term capital gains bracket.

How sharper.tax Helps

sharper.tax analyzes your tax return to identify real estate gains, calculate your effective capital gains rate, and recommend strategies like 1031 exchanges, loss harvesting, and optimal sale timing. The tax code is complicated, but better tools have leveled the field — we make sophisticated real estate tax planning available for free.

Sources

The information above is educational and not tax advice.