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.

Data reviewed: July 2026. Figures here come from published sources and change over time. How we verify

Put this calculator on your website for 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 of 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). That is 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.

Selling your home: a couple's full walkthrough

Here's the math most sellers actually face, start to finish. A married couple bought their house for $350,000, replaced the roof and remodeled the kitchen over the years for $40,000, and after 12 years sells for $600,000, paying $36,000 (6%) in agent commissions and closing costs.

Adjusted basis ($350,000 + $40,000)$390,000
Net proceeds ($600,000 − $36,000)$564,000
Capital gain$174,000
§121 exclusion (married, 2-of-5-year test met)−$174,000
Federal capital gains tax$0

The $500,000 married exclusion swallows the entire $174,000 gain. In fact, even a single filer's $250,000 exclusion would have covered it, and even with zero receipts for the improvements the gain would only rise to $214,000, still fully excluded. That's typical: most owner-occupied sales owe nothing. The exclusion becomes a live issue when gains are large (long-held homes in expensive markets, or single filers bumping against the $250,000 ceiling), and that's exactly when documented improvements earn their keep.

One thing that surprises people: your mortgage payoff is irrelevant to the gain. If the couple still owed $200,000 on the mortgage, that reduces the check they walk away with, but not the taxable gain; the IRS compares sale price to basis, not to what you kept.

The 2026 long-term capital gains rates

For tax year 2026, the long-term rates and taxable-income thresholds are:

RateSingleMarried filing jointly
0%Up to $49,450Up to $98,900
15%$49,451 to $545,500$98,901 to $613,700
20%Over $545,500Over $613,700

Two clarifications that prevent most bracket panic. First, the thresholds apply to your total taxable income including the gain, but crossing one only changes the rate on the dollars above it, never on the whole gain. Second, unlike sales tax, which hits the full price at the register, capital gains tax touches only your profit. High earners also owe the 3.8% net investment income tax on gains above $200,000 of income (single) or $250,000 (married), though gain excluded under §121 doesn't count toward it.

Short-term gains get none of this: own the property a year or less and the gain simply stacks on top of your wages at ordinary rates. On a $50,000 gain, that's $11,000 at a 22% bracket versus $7,500 at the 15% long-term rate; the one-year line is worth $3,500 on its own. The same 0/15/20 structure applies to stocks and funds, which is why the S&P 500 investment calculator pairs naturally with this one. And remember most states tax gains on top of the federal bill, anywhere from 0% (Texas, Florida) to over 13% (California), so treat this estimate as the federal floor.

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. Every one of those raises your basis and shrinks your taxable gain dollar for dollar. In the worked 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.

The basis-building checklist

The audit-relevant test: does the work add value, prolong the property's life, or adapt it to a new use (an improvement, which counts), or does it merely keep the property in ordinary operating condition (a repair, which doesn't)?

Counts toward basis: additions and finished basements; kitchen and bath remodels; a new roof (full replacement); new HVAC, furnace, or water heater; replacement windows; decks, patios, and fences; built-in appliances; permanent landscaping like retaining walls and paved driveways; plus certain purchase closing costs: title fees, recording fees, transfer taxes, and survey costs.

Doesn't count: painting; fixing leaks, gutters, or a few broken shingles; patching drywall; servicing the furnace; replacing a cracked windowpane; general cleaning and upkeep. Also excluded, despite being large checks you wrote for years: mortgage interest, homeowner's insurance, and property taxes. Those are annual costs of ownership, not investments in the asset.

One useful gray-zone rule: a repair done as part of a larger remodel gets absorbed into the improvement and counts. Replacing a broken window is a repair; replacing every window during a renovation is an improvement.

Rental and investment property: two big asterisks

Both of these sit beyond what this calculator computes, and both matter enough to flag honestly.

Depreciation recapture. If the property was ever a rental, the depreciation you deducted while renting it out (or were allowed to deduct, even if you never claimed it) gets taxed at up to 25% when you sell, separately from the regular capital gains rates on the rest. On a property rented for a decade, that recaptured amount is routinely tens of thousands of dollars of "gain" you never saw as cash. A rental sale is worth a tax professional's hour.

1031 exchanges. Investment real estate (not your home) can be sold and the entire tax bill deferred by rolling the proceeds into another like-kind investment property. But the rules are rigid: a qualified intermediary must hold the money, replacement property must be identified within 45 days, and the purchase must close within 180. And it's a deferral, not forgiveness: your old, low basis carries into the new property, so the tax bill waits rather than disappears.

Sources

Where the numbers on this page come from. We go to the body that publishes the figure, not to another calculator. Figures on this page were checked against these sources in July 2026. See how we verify.

Frequently asked questions

Do I pay capital gains tax when I sell my house?

Often not. 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, which covers most owner-occupied sales entirely. Gain beyond the exclusion 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.

How do I avoid capital gains tax on real estate?

The legitimate levers: live in the home for 2 of the last 5 years to claim the $250K/$500K exclusion; document every capital improvement to raise your basis; deduct selling costs; hold longer than one year so long-term rates apply; and for investment property, defer the tax with a 1031 exchange into another investment property. Beyond those, a large gain is simply taxable; schemes that promise otherwise are worth deep skepticism.

What are the capital gains tax rates for 2026?

For tax year 2026, long-term gains are taxed at 0% up to $49,450 of taxable income (single) or $98,900 (married filing jointly), 15% up to $545,500/$613,700, and 20% above that. Short-term gains (property held a year or less) are taxed as ordinary income at 10% to 37%. Crossing a threshold only changes the rate on the dollars above it, never the whole gain.

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% to 37%). Own it longer than a year and it becomes long-term, taxed at 0%, 15%, or 20%. On a $50,000 gain, that one-year line is the difference between $11,000 in tax at a 22% bracket and $7,500 at the 15% long-term rate.

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.

What is a 1031 exchange?

A tax-deferred swap of one investment property for another. Sell an investment property, have a qualified intermediary hold the proceeds, identify a replacement within 45 days, close within 180, and the capital gains tax is deferred, not erased, since your old basis carries into the new property. It's for investment real estate only, never your primary residence.

Do I have to report my home sale to the IRS?

If you receive Form 1099-S from the closing agent, you must report the sale on your return even if the entire gain is excluded. If you don't receive one and the full gain qualifies for the exclusion, the sale generally doesn't need to be reported. Either way, keep your basis records; the burden of proving improvements is yours.

Will selling my house push me into a higher tax bracket?

Not the way people fear. Long-term gains are taxed under their own 0%/15%/20% schedule that stacks on top of your ordinary income; the gain can't push your wages into a higher ordinary bracket. What a large gain can do is push itself across the 15% or 20% capital gains thresholds and trigger the 3.8% net investment income tax, so the effective rate on a big taxable gain can be higher than you'd guess.

Related calculators