Capital Gains Tax Calculator

Enter what you paid, what you improved, and what you're selling for, and get your estimated federal capital gains tax — including the $250,000/$500,000 primary residence exclusion and short- vs. long-term rates.

Put this calculator on your website — free

Copy one snippet and give your visitors a working Capital Gains Tax Calculator.

How capital gains tax on real estate works

The IRS doesn't tax your sale price — it taxes your gain: what you netted after selling costs, minus everything you have invested in the property (your adjusted basis). Hold for a year or more and the gain is long-term, taxed at 0%, 15%, or 20% depending on income; sell inside a year and it's short-term, taxed as ordinary income at your regular bracket — 10% to 37%.

If the home was your primary residence for at least 2 of the last 5 years, Section 121 lets you exclude up to $250,000 of gain (single) or $500,000 (married filing jointly) — the single biggest tax break most households ever touch, usable once every two years.

The formula

Tax = ((Sale − Selling costs) − (Purchase + Improvements) − Exclusion) × Rate

Sale minus selling costs is your net proceeds; purchase price plus capital improvements is your adjusted basis; the difference is the gain. The §121 exclusion (if you qualify) comes off before the rate is applied, and the rate is long-term or short-term depending on how long you owned it.

Worked example

A single owner bought a home for $300,000, put $50,000 of improvements into it (adjusted basis $350,000), and sells 8 years later for $650,000 with $39,000 in agent fees and closing costs (net proceeds $611,000).

The gain is $261,000. As a primary residence owned well over 2 years, the $250,000 exclusion applies, leaving $11,000 taxable. At the 15% long-term rate, the federal tax is just $1,650 — on a sale with a $350,000 price run-up. Married filing jointly, the $500,000 exclusion would cover the entire gain: $0.

Basis is the lever everyone forgets

Most people can quote their sale price and purchase price; almost nobody can produce receipts for the new roof, the kitchen remodel, the deck, or the HVAC system — and every one of those raises your basis and shrinks your taxable gain dollar for dollar. In the example above, forgetting the $50,000 of improvements would have added $7,500 to the tax bill. Repairs and maintenance don't count; improvements that add value or extend the property's life do. Keep the folder.

Two more things this calculator deliberately doesn't compute: if the property was ever a rental, the depreciation you took (or were allowed to take) gets recaptured at up to 25% when you sell — a genuine gotcha that deserves a tax professional. And most states tax capital gains on top of the federal bill, anywhere from 0% (Texas, Florida) to over 13% (California). Treat this estimate as the federal floor, not the whole story.

Frequently asked questions

How much capital gains tax will I pay when I sell my house?

Often zero. If it was your primary residence for 2 of the last 5 years, up to $250,000 of gain (single) or $500,000 (married filing jointly) is excluded under Section 121. Gain beyond that is taxed at long-term rates — 0%, 15%, or 20% depending on your income — plus any state tax.

What is the 2-out-of-5-year rule?

To claim the home-sale exclusion you must have both owned the home and used it as your main residence for at least 2 of the 5 years before the sale. The two years don't have to be continuous or the most recent ones, and you can use the exclusion repeatedly — just not more than once every two years.

What counts as a capital improvement for cost basis?

Anything that adds value, extends the property's life, or adapts it to new uses: remodels, additions, a new roof, HVAC, decks, landscaping. Repairs and maintenance — painting, patching, fixing leaks — don't count. Every improvement dollar you can document reduces your taxable gain dollar for dollar, so keep receipts.

What's the difference between short-term and long-term capital gains?

Ownership of one year or less makes the gain short-term, taxed as ordinary income at your regular bracket (10%–37%). Own it longer than a year and it becomes long-term, taxed at 0%, 15%, or 20%. On a big gain, crossing that one-year line can cut the rate by more than half.

Do I pay capital gains tax on a rental property sale?

Yes, and there's an extra layer: depreciation you claimed (or could have claimed) while renting is recaptured at up to 25% when you sell, on top of capital gains on the rest. The §121 exclusion generally doesn't apply unless you converted it back to your primary residence, and even then it's prorated. A rental sale is worth a tax professional's hour.

Related calculators