SuperMoney logo
SuperMoney logo

Capital Gains Tax on Real Estate: Rates, Exclusions, and How to Calculate Your Gain

Ante Mazalin avatar image
Last updated 05/27/2026 by

Ante Mazalin

Fact checked by

Andy Lee

Summary:
Capital gains tax on real estate is a federal tax on the profit earned when you sell a property for more than you paid for it, with rates ranging from 0% to 20% depending on how long you owned the property and your taxable income.
The tax treatment differs significantly depending on whether the property is a primary residence, a rental, or an investment property.
  • Primary residence exclusion: Homeowners who meet the ownership and use tests can exclude up to $250,000 in gain ($500,000 for married couples) from federal capital gains tax entirely.
  • Long-term vs. short-term rates: Properties held longer than one year qualify for lower long-term capital gains rates; properties sold within a year are taxed as ordinary income.
  • Investment property rules: Rental and investment properties do not qualify for the primary residence exclusion, but a 1031 exchange allows investors to defer — not eliminate — the tax by rolling proceeds into a like-kind property.
For most homeowners, the primary residence exclusion means selling a house triggers no federal capital gains tax at all. For investors and those whose gains exceed the exclusion, understanding the rates, basis calculations, and deferral options can mean tens of thousands of dollars in tax savings.

Primary residence exclusion: the Section 121 rule

Section 121 of the Internal Revenue Code allows homeowners to exclude up to $250,000 of capital gain from the sale of a primary residence — $500,000 for married couples filing jointly. To qualify, the seller must have owned the home and used it as their primary residence for at least two of the five years immediately before the sale.
The two-year ownership and use periods do not need to be continuous. A homeowner who moved out 18 months ago and rented the property still qualifies if they lived there as their primary residence for two years out of the preceding five. According to the IRS, this exclusion can be used repeatedly, but no more than once every two years.
Filing StatusMaximum ExclusionOwnership + Use Requirement
Single$250,0002 of last 5 years
Married filing jointly$500,000Both spouses must meet use test; only one must meet ownership test
Widowed (within 2 years of spouse’s death)$500,000Same as married filing jointly

How to calculate capital gain on a real estate sale

  1. Start with the sale price: Use the gross sale price from the closing disclosure, before subtracting commissions or closing costs.
  2. Calculate your adjusted cost basis: Begin with what you paid for the property. Add the cost of capital improvements (a new roof, addition, or kitchen remodel — not repairs). Add certain closing costs from the original purchase such as title fees and transfer taxes.
  3. Subtract selling expenses: Real estate commissions, title fees, and other allowable closing costs on the sale reduce your realized amount and effectively lower the taxable gain.
  4. Calculate the gain: Subtract your adjusted cost basis and selling expenses from the sale price. The result is your capital gain.
  5. Apply the exclusion: If the property qualifies as your primary residence, subtract the applicable exclusion amount ($250,000 or $500,000).
  6. Apply the correct tax rate: If any gain remains after the exclusion, determine whether it is long-term (held more than one year) or short-term (one year or less) and apply the appropriate rate.
Example: A single filer bought a home for $300,000, made $50,000 in improvements, and sold it for $700,000 with $20,000 in selling costs. Adjusted basis is $350,000. Net proceeds are $680,000. Gain is $330,000. After the $250,000 exclusion, $80,000 is taxable at long-term capital gains rates.

Long-term capital gains rates on real estate

For property held longer than one year, capital gains are taxed at preferential rates based on taxable income. The 2025 thresholds are:
RateSingle Filer IncomeMarried Filing Jointly Income
0%Up to $48,350Up to $96,700
15%$48,351 to $533,400$96,701 to $600,050
20%Over $533,400Over $600,050
High-income sellers may also owe the 3.8% Net Investment Income Tax (NIIT) on top of the standard capital gains rate. The NIIT applies to the lesser of net investment income or the amount by which modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).

Pro Tip

Home improvements increase your cost basis and directly reduce your taxable gain — but only capital improvements qualify, not routine repairs. Replacing a roof, adding a bathroom, or finishing a basement counts. Fixing a leaky faucet or repainting walls does not. Keep receipts and records for every improvement you make to the property, even if you do not plan to sell for years. The IRS can audit the basis calculation, and documentation from a decade ago is surprisingly hard to reconstruct.

Capital gains tax on rental and investment property

Rental properties do not qualify for the Section 121 exclusion. When you sell a rental property, the entire gain is taxable — but two additional rules apply that do not affect primary residences.
First, depreciation recapture. The IRS requires sellers to “recapture” the depreciation deductions taken during the rental period, taxed at a flat 25% rate rather than the standard long-term capital gains rate. If you claimed $40,000 in depreciation over 10 years, that $40,000 is taxed at 25% regardless of your income bracket.
Second, a property tax basis adjustment. In some states, property tax assessments trigger partial basis recalculations that can affect the reported gain. Consult a CPA familiar with investment real estate before closing.

The 1031 exchange: deferring capital gains on investment property

A 1031 exchange (named for Section 1031 of the Internal Revenue Code) allows an investor to sell a rental or investment property and defer all capital gains tax by reinvesting the proceeds into a like-kind property. The exchange does not eliminate the tax — it defers it until the replacement property is eventually sold without a subsequent exchange.
Strict timing rules apply: the seller must identify a replacement property within 45 days of the sale and close on it within 180 days. The replacement property must be of equal or greater value. Any cash not reinvested (called “boot”) is taxable in the year of the exchange.

How to Reduce Your Capital Gains Tax Bill

The strategy depends on what you’re selling. These guides cover the most common asset types where timing and structure can make a significant difference.

Stepped-up basis at death

When a property owner dies, the heirs receive a stepped-up cost basis equal to the property’s fair market value on the date of death. This eliminates the capital gains tax on all appreciation that occurred during the decedent’s lifetime.
A property purchased for $100,000 that is worth $600,000 at the owner’s death passes to heirs with a $600,000 basis. If they sell immediately for $600,000, there is no capital gain and no tax owed. This stepped-up basis rule is one of the most significant tax advantages of holding appreciated real estate until death rather than selling or gifting it during one’s lifetime.
Good to know: State capital gains taxes are separate from federal taxes and vary widely. California taxes capital gains as ordinary income with no preferential rate, adding up to 13.3% on top of the federal tax. Florida and Texas have no state income tax, meaning sellers there owe only federal capital gains tax. Always calculate both federal and state tax exposure before evaluating whether to sell.

Frequently asked questions

Do I owe capital gains tax if I sell my home at a loss?

No. Capital gains tax only applies to gains — if you sell a primary residence for less than you paid, there is no taxable gain. However, losses on the sale of a primary residence are also not deductible. Losses on investment or rental properties are deductible against other capital gains and, under passive activity rules, potentially against ordinary income up to $25,000 per year for qualifying landlords.

What if I lived in the home for less than two years?

You may still qualify for a partial exclusion if you sold because of a change in employment, health reasons, or certain unforeseen circumstances. The partial exclusion is prorated based on how long you did meet the two-year test. For example, a single filer who lived in the home for one year (50% of two years) can exclude up to $125,000 (50% of $250,000).

How does a home office affect capital gains tax?

If you claimed a home office deduction and used the actual expense method (not the simplified $5/sq ft method), the portion of the home allocated to the office does not qualify for the Section 121 exclusion and may be subject to depreciation recapture. The simplified method generally does not create this problem. Consult a tax professional before selling a home where you have taken home office deductions.

Are capital gains from a rental property taxed differently than from stocks?

The long-term capital gains rates are the same for both, but real estate has the additional depreciation recapture component taxed at 25%. Stocks do not carry depreciation recapture. Real estate investors also have access to the 1031 exchange deferral mechanism, which has no equivalent for stock sales.

Can I avoid capital gains tax by moving back into a rental property?

Partially. If you convert a rental back to your primary residence and live there for two years before selling, you can apply the Section 121 exclusion — but only to the gain allocated to the period of primary residence use. The portion of gain attributable to periods of non-qualifying use (such as rental periods after May 6, 1997) is not excludable. Depreciation recapture is also not eliminated by re-occupancy.

Related reading on real estate taxes and gains

  • Capital gains tax — a full overview of how capital gains are taxed across all asset types, including the rates, holding period rules, and loss harvesting strategies.
  • Short-term capital gains tax — explains how gains on properties held one year or less are taxed as ordinary income, which is relevant for house flippers and quick resales.
  • Step-up in basis — details how inherited property receives a new cost basis at the date of death, eliminating capital gains tax on lifetime appreciation.
  • Property tax — covers the annual tax on real estate assessed by local governments, separate from the federal capital gains tax triggered at sale.

Key takeaways

  • Homeowners can exclude up to $250,000 ($500,000 married) of capital gain on a primary residence sale if they meet the two-of-five-year ownership and use tests.
  • Long-term capital gains rates are 0%, 15%, or 20% depending on income; gains on properties held one year or less are taxed as ordinary income.
  • Rental property sellers owe depreciation recapture tax at 25% on deductions taken during the rental period, in addition to capital gains tax on the remaining gain.
  • A 1031 exchange defers — but does not eliminate — capital gains tax on investment property by rolling proceeds into a like-kind replacement.
  • Heirs who inherit property receive a stepped-up basis equal to fair market value at death, effectively erasing lifetime capital gains for federal tax purposes.
For homeowners and investors evaluating a sale or refinance, compare mortgage and home equity options at SuperMoney’s mortgage reviews.
Table of Contents