Capital Gains Tax on Real Estate — Exclusions, Rates, and How to Reduce It

#capital gains tax#real estate tax#home sale exclusion#investment property#1031 exchange

Real estate is where capital gains tax gets complicated — and where the biggest tax breaks exist. Sell your primary residence and you might owe nothing. Sell a rental property and you could face federal gains tax, state tax, NIIT, and depreciation recapture all at once. The rules are worth understanding before you list.

Estimate your tax before selling with the Capital Gains Tax Calculator

Primary Residence — The Section 121 Exclusion

The most generous capital gains exemption in the tax code: you can exclude up to $250,000 in gains ($500,000 if married filing jointly) when selling your primary residence.

Qualification Requirements

RequirementDetails
Ownership testYou owned the home for at least 2 of the last 5 years
Use testYou lived in the home as your primary residence for at least 2 of the last 5 years
FrequencyYou haven't used the exclusion in the past 2 years

The 2-year periods don't need to be consecutive. You could live in the home for year 1 and year 3, rent it out for years 2, 4, and 5, and still qualify — as long as you sell within the 5-year window.

How It Works

ItemAmount
Purchase price (2018)$300,000
Improvements (new roof, kitchen)$45,000
Adjusted cost basis$345,000
Sale price (2026)$550,000
Selling costs (agent commissions, closing)$33,000
Net proceeds$517,000
Capital gain$172,000
Exclusion (married)$500,000
Taxable gain$0

Most homeowners selling a primary residence owe nothing. The exclusion covers gains up to half a million dollars for couples.

For a deeper look at qualifying scenarios, see our home sale tax exclusion guide.


What Counts as Cost Basis for Real Estate

Your cost basis isn't just the purchase price. It includes:

Adds to BasisDoesn't Add to Basis
Purchase priceRoutine maintenance
Closing costs when buying (title fees, attorney)Homeowners insurance premiums
Major improvements (roof, HVAC, addition)Property taxes paid
Assessment for local improvements (sidewalks)Mortgage interest
Legal fees to defend titleUtility costs

Keep receipts for every improvement. A $45,000 kitchen remodel increases your basis by $45,000, reducing your taxable gain by the same amount. This matters most when gains exceed the $250,000/$500,000 exclusion — or for investment properties where there's no exclusion at all.


Investment Property — No Exclusion

Rental properties, vacation homes, and land don't qualify for the Section 121 exclusion. The full gain is taxable.

Tax Layers on Investment Property Sales

TaxRateApplies To
Long-term capital gains0%, 15%, or 20%Gain above depreciation
Depreciation recapture25% (flat)Accumulated depreciation
NIIT surcharge3.8%If MAGI exceeds $200K/$250K
State income tax0–13.3%Varies by state

Depreciation Recapture — The Surprise Tax

If you claimed depreciation deductions on a rental property (and you should have — it's required), the IRS "recaptures" that depreciation when you sell, taxing it at 25%.

Example: You bought a rental for $300,000 (land: $60,000, building: $240,000). Over 10 years, you depreciated $87,273 ($240,000 ÷ 27.5 years × 10). When you sell for $450,000:

ComponentAmountTax Rate
Depreciation recapture$87,27325% = $21,818
Capital gain above basis$62,72715% = $9,409
NIIT (if applicable)On full gain3.8% = $5,700
Total federal tax~$36,927

That's before state taxes. A California investor could pay over $50,000 on this sale.


1031 Exchange — Deferring Gains on Investment Property

A 1031 exchange lets you defer capital gains tax by reinvesting the proceeds into a "like-kind" replacement property.

1031 Exchange RulesDetails
Property typeInvestment or business real estate only (not primary residence)
Identification deadline45 days to identify replacement property
Closing deadline180 days to close on replacement
Value requirementReplacement must be equal or greater value
Qualified intermediaryMust use a third-party QI to hold funds

Key benefit: You can chain 1031 exchanges throughout your lifetime, deferring gains indefinitely. At death, heirs receive a stepped-up basis, potentially eliminating the deferred gain entirely.

Key risk: Miss either deadline and the entire gain becomes taxable immediately.


Partial Exclusion — When You Don't Meet the Full Requirements

If you don't meet the 2-year ownership or use test, you may still qualify for a partial exclusion if you moved due to:

  • Work relocation (new job at least 50 miles farther)
  • Health reasons
  • Unforeseen circumstances (divorce, death of spouse, natural disaster)

The partial exclusion is prorated. If you lived in the home for 1 year (half of the 2-year requirement), you can exclude up to 50% of the full amount — $125,000 (single) or $250,000 (married).


Converting a Rental to Primary Residence

You can move into a rental property, live there for 2+ years, and use the Section 121 exclusion — but with limitations since 2009:

Non-qualified use rule: Any period after 2008 when the property wasn't your primary residence is "non-qualified use." Gains attributable to that period don't qualify for the exclusion.

Example: You owned a rental for 8 years, then moved in for 3 years (total 11 years). Non-qualified use = 8/11 of the gain. Only 3/11 of the gain qualifies for the exclusion.

Depreciation recapture is never excludable — even on a primary residence conversion.


Strategies to Reduce Real Estate Capital Gains Tax

  1. Live in it for 2 years — The Section 121 exclusion is the most powerful tool.
  2. Track all improvements — Every dollar of documented improvement reduces your taxable gain.
  3. Use a 1031 exchange — Defer gains on investment properties indefinitely.
  4. Time the sale — Sell in a year when your other income is lower to stay in a lower capital gains bracket.
  5. Installment sale — Spread the gain over multiple years to manage bracket creep.
  6. Opportunity Zone investment — Reinvest gains into a Qualified Opportunity Zone fund for deferral and potential reduction.

Check your estimated tax before listing with the Capital Gains Tax Calculator and plan your mortgage numbers with the Mortgage Calculator.


Bottom Line

Primary residence sellers can exclude $250,000/$500,000 in gains — most homeowners owe nothing. Investment property sellers face capital gains tax, depreciation recapture at 25%, potential NIIT, and state taxes — which can total 30–40%+ of the gain. A 1031 exchange is the most effective way to defer investment property gains. Before selling any property, run the numbers to understand your total tax exposure and whether timing or structuring strategies could reduce your bill.

Share this article