The Money Pocket

Real Estate Capital Gains Tax Calculator

Calculate federal capital gains tax on a home or rental property sale. Includes Section 121 exclusion, NIIT, 1031 exchange, and Opportunity Zone scenarios.

Real Estate Investing Guide Hub

Estimate how much federal tax you'll owe when you sell a property. This calculator applies the correct long-term capital gains brackets, the Section 121 primary residence exclusion, the 3.8% Net Investment Income Tax, and lets you compare standard sale vs. 1031 exchange vs. Opportunity Zone scenarios.

Property & Sale Details
Purchase Details
Sale Details
Tax Profile
Tax Strategies

1031 Exchange

Defer tax into a like-kind property

Opportunity Zone Investment

Potential deferral & reduction

Tax Estimate
Holding Period:Long-Term (> 1 year)

Cost Basis

$326,000

Adjusted Proceeds

$485,000

Raw Capital Gain

$159,000

Section 121 Exclusion

$0

Taxable Gain

$159,000

Federal CG Tax

$23,850

NIIT (3.8%)

$1,482

Total Federal Tax

$25,332

Effective Rate on Gain

15.93%

Net Profit After Tax

$133,668

Applied LTCG Rates: $0 @ 0% / $159,000 @ 15% / $0 @ 20%
Scenario Comparison
Standard (No Deferral)$25,332 owed
1031 Exchange(enable above)
$0 deferred
Opportunity Zone(enable above)
~$0 potential reduction
State capital gains taxes are not included. California, for example, taxes capital gains as ordinary income at rates up to 13.3%.
This is an estimate for educational purposes only. Consult a tax professional for advice specific to your situation.

How to Calculate Your Cost Basis

Your cost basis is the starting point for all capital gains calculations. It determines how much of your sale proceeds are taxable.

Cost Basis = Purchase Price + Buying Closing Costs + Capital Improvements

Purchase price is the amount you paid. Buying closing costs include title fees, attorney fees, recording fees, and points paid to obtain financing — but not prepaid interest or property taxes (which are deductible separately). Capital improvements are permanent additions or renovations that extend the life or increase the value of the property: a new roof, an addition, a kitchen remodel. Regular maintenance and repairs do not add to basis.

Adjusted sale proceeds are your gross sale price minus selling costs:

Adjusted Proceeds = Sale Price − Selling Costs

Selling costs typically include real estate agent commissions (5–6%), title fees, attorney fees, transfer taxes, and concessions to the buyer. On a $500,000 sale, selling costs of 6% reduce your taxable proceeds by $30,000.

Taxable Gain = Adjusted Proceeds − Cost Basis

The Primary Residence Exclusion (Section 121)

Section 121 of the Internal Revenue Code is one of the most valuable tax breaks available to homeowners. If you meet the requirements, you can exclude a significant portion of your gain from federal tax entirely.

Exclusion Amounts

Filing StatusMaximum Exclusion
Single$250,000
Married Filing Jointly$500,000

The 2-of-5-Year Test

To qualify, you must have owned the home and used it as your primary residence for at least 2 of the 5 years immediately before the sale. The two years don't have to be consecutive, and ownership and use can overlap.

Critically, the test requires both ownership and use. A property you owned but rented out for the last 4 years, for example, would not qualify even if you owned it for 10 years.

Partial Exclusions

The IRS allows a partial exclusion if you fail to meet the full 2-year test due to a qualifying reason: a change in employment, health reasons, or unforeseen circumstances (such as divorce or condemnation of the property). The partial exclusion is prorated based on how long the 2-of-5 test was met.

After a 1031 Exchange

If you previously acquired the property through a 1031 exchange, you must wait 5 years (not 2) before the Section 121 exclusion applies, and you still need to meet the 2-of-5 use test.

Short-Term vs Long-Term Capital Gains Rates

Holding period determines your tax rate — and the difference is dramatic.

Short-Term (≤ 1 Year)

If you sell within 12 months of purchase, your gain is taxed as ordinary income at your marginal rate — the same rate applied to wages. Depending on your income level, this can reach 37%.

Long-Term (> 1 Year)

Hold for more than 12 months and you qualify for preferential long-term capital gains rates:

Total Taxable IncomeRate (Single)Rate (MFJ)
Up to $48,350 / $96,7000%0%
$48,351–$533,400 / $96,701–$600,05015%15%
Above $533,400 / $600,05020%20%

Long-term rates are stacked on top of ordinary income. If your ordinary income already exceeds the 0% bracket threshold, even $1 of long-term gain is taxed at 15%. If your ordinary income plus the gain pushes you into the highest bracket, the gain above that threshold is taxed at 20%.

Net Investment Income Tax (NIIT)

The Net Investment Income Tax is an additional 3.8% surtax on investment income — including real estate capital gains — for higher-income taxpayers:

Filing StatusNIIT Income Threshold
Single$200,000
Married Filing Jointly$250,000

NIIT applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds the threshold. If you're single with $180,000 of ordinary income and a $100,000 taxable capital gain, $80,000 of that gain is subject to the 3.8% NIIT.

The effective maximum federal rate on long-term real estate gains for high earners is therefore 23.8% (20% LTCG + 3.8% NIIT).

1031 Exchange: Deferring the Tax

A 1031 exchange (named for IRC Section 1031) allows you to defer capital gains tax by rolling your sale proceeds into a "like-kind" replacement property. The rules are strict:

  • You must identify the replacement property within 45 days of closing
  • You must close on the replacement property within 180 days
  • The replacement property must be of equal or greater value
  • Proceeds must flow through a qualified intermediary — you cannot take possession of the cash

A successful 1031 exchange defers 100% of the federal capital gains and NIIT owed. The tax doesn't disappear — it carries forward into the basis of the new property — but repeated 1031 exchanges allow investors to compound growth indefinitely, with taxes potentially eliminated at death through a stepped-up basis.

Opportunity Zone Investments

Qualified Opportunity Zones (QOZs) are another deferral strategy. By investing capital gains proceeds into a Qualified Opportunity Fund (QOF) within 180 days of the sale, you can:

  • Defer recognition of the original gain until the earlier of QOF exit or December 31, 2026
  • Potentially eliminate federal tax on any appreciation inside the QOF if held for 10+ years

The Opportunity Zone program is complex and requires careful structuring. The tax benefits above are simplified estimates — actual results depend on the holding period, the QOF's structure, and future legislation.

For a thorough walkthrough of how capital gains work on home sales vs. rental properties, read: Capital Gains Tax on Real Estate: Home vs Rental.


Sources: IRS Publication 523 — Selling Your Home, Rocket Mortgage — Capital Gains Tax on Real Estate, SmartAsset — Capital Gains Tax, IRS — Net Investment Income Tax

More Real Estate Investing Guide Tools

Other tools in the Real Estate Investing Guide hub
1031 Exchange Tax Calculator - Like-Kind Exchange Tax Deferral
Calculate tax deferral benefits and requirements for 1031 like-kind exchanges. Optimize real estate investment strategies with accurate tax analysis.
After Tax Cash Flow Calculator - Real Estate Investment Analysis
Calculate after-tax cash flow for real estate investments and business analysis. Comprehensive tool for investment decision-making and tax planning.
Investment Property Mortgage Calculator
Calculate monthly mortgage payments, PITIA, and debt-to-income ratios for investment properties and primary residences. Includes PMI and DTI analysis.
Mortgage Refinance Calculator - Should You Refinance Analysis
Free mortgage refinance calculator with break-even analysis. Calculate refinancing savings, closing costs, and determine if refinancing makes financial sense.
Opportunity Zone Calculator - QOZ Tax Benefits Analysis
Free Opportunity Zone calculator for 3-tier tax benefits. Calculate QOZ investment tax savings, deferral, step-up basis, and gain elimination strategies.
Real Estate Investor DTI & Borrowing Power Calculator
Calculate your debt-to-income ratio as a real estate investor and find out exactly how much you can borrow for your next investment property.
REIT Investment Calculator - Real Estate Investment Trust Analysis
Free REIT calculator to analyze dividend income, tax implications, and total returns. Compare REIT types and optimize your real estate investment strategy.
Rental Property After-Tax Cash Flow Calculator
Calculate after-tax cash flow for rental properties including depreciation, mortgage interest deduction, and estimated tax liability.
US Rental Property ROI Calculator
Calculate NOI, cap rate, cash-on-cash return, DSCR, and total ROI for any US rental property investment in seconds.