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
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:
| Rate | Single | Married filing jointly |
|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 |
| 15% | $49,451 to $545,500 | $98,901 to $613,700 |
| 20% | Over $545,500 | Over $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.