Home Sale Capital Gains Calculator
Build the gain from adjusted basis rather than from the purchase price, apply the section 121 exclusion, and keep any depreciation recapture separate — the way the return actually orders it.
Home sale gain and exclusion calculator
Gain is not sale price minus purchase price
The number that gets taxed is measured against adjusted basis, and adjusted basis is a running total that starts at what you paid and then moves in two directions. It goes up with capital improvements. It goes down with depreciation. Selling costs work at the other end, reducing the amount you are treated as realising rather than adding to basis, though the arithmetic reaches the same place.
That means the seller who says "I bought at $310,000 and sold at $620,000, so I made $310,000" is usually overstating the taxable amount twice: once by ignoring improvements, once by ignoring what the sale itself cost. On the same house the true gain can be $200,000 or less — often the difference between a taxable event and a fully excluded one.
Improvement or repair: the distinction that decides the number
An improvement adds value, prolongs the life of the property, or adapts it to a new use. A repair keeps it in ordinary working condition. Only the first kind adds to basis, and the gap between the two categories is where most of the money sits.
| Adds to basis | Does not |
|---|---|
| New roof, whole-house re-roof | Patching a leak |
| Room addition, finished basement | Repainting interior walls |
| Replaced HVAC or furnace | Annual service call |
| New windows, siding, insulation | Replacing one cracked pane |
| Kitchen or bath remodel | Fixing a dripping faucet |
| Driveway, permanent landscaping, fence | Mowing, seasonal planting |
| Solar array, generator, whole-house rewire | Replacing a light fixture |
The records are the whole game. A homeowner with $65,000 of documented improvements and one with a vague memory of "we did the roof and the kitchen" face very different outcomes, and the receipts have to survive a decade or two in a filing cabinet. Photograph invoices and keep them with the deed.
The two-of-five test is really two tests
During the five years ending on the sale date you must have owned the home for at least 24 months and lived in it as your main home for at least 24 months. The two periods can overlap, need not be continuous, and need not cover the same months.
For a married couple claiming $500,000, the requirements split. At least one spouse must satisfy ownership. Both spouses must satisfy use. A couple where one spouse moved into the other's long-held home two years ago passes ownership through one spouse and use through both — full $500,000. A couple where only one spouse lived there fails the shared use test and is limited to a single $250,000 exclusion.
There is also a frequency rule that catches serial movers: no exclusion if either spouse excluded gain from another home sale within the two years before this one.
Partial exclusion, when the move is not voluntary
Selling before 24 months does not automatically forfeit everything. A qualifying reason produces a prorated exclusion equal to the full ceiling multiplied by qualifying months over 24. Twelve months into a job relocation, a married couple's ceiling is $500,000 × 12 ÷ 24, or $250,000 — frequently enough to cover the entire gain on a short holding period.
Qualifying reasons are narrower than people assume and fall into three families: a change in employment location that adds a commute distance threshold, a health condition that requires a move, and an unforeseeable event — divorce, death, unemployment, a disaster that destroys the home, multiple births from one pregnancy. A voluntary upgrade does not qualify, and neither does a move made purely to capture a hot market.
Recapture comes out first, and the exclusion does not touch it
If the home was ever rented, or had a home office claimed under the actual expense method, there is depreciation in the basis and the tax code takes that benefit back on sale. The mechanism matters: unrecaptured section 1250 gain is separated from the rest of the gain and taxed at up to 25% before the section 121 exclusion is applied to what remains.
The order is the part that gets missed. The exclusion is not applied to the whole gain and then reduced by recapture. Recapture is carved out first and taxed on its own, and only the residue is eligible for exclusion. Two consequences follow. A fully excluded sale can still produce a tax bill. And the "allowed or allowable" rule means depreciation you were entitled to claim is recaptured whether or not you claimed it — skipping the deduction on a return does not skip the tax.
When no exclusion applies at all
Three situations wipe it out entirely: the home was never your principal residence, the two-of-five test fails with no qualifying reason, or you already excluded gain from another sale within the prior two years. A rental that was never lived in does not qualify, a vacation home does not qualify, and land held separately from the house does not qualify.
There is one nuance worth knowing for a converted rental. If you lived in the house as your main home for at least two of the five years before selling, the section 121 exclusion can still shelter the appreciation portion of the gain. The depreciation portion follows its own rule and is taxed regardless — the so-called depreciation-adjusted limit applies to the post-2008 rental period.
State tax is a separate question
Nothing in section 121 obliges a state to follow the federal exclusion. Most states conform, but several impose their own recapture of prior depreciation, and a few tax gain that the federal return excludes entirely. A seller in a state with an income tax should check the state treatment before assuming the federal answer carries over.
Frequently asked questions
Does the $250,000 exclusion cover depreciation I claimed while renting?
No. Unrecaptured section 1250 gain is taxed at up to 25% and is carved out before the exclusion is applied. The exclusion only reaches the gain that remains after recapture.
What counts as an improvement rather than a repair?
An improvement adds value, prolongs the life of the home, or adapts it to a new use — a new roof, an addition, a replaced HVAC system, permanent landscaping. A repair maintains ordinary condition: repainting, patching drywall, fixing a leak.
Can I get part of the exclusion if I sell before two years?
Yes, with a qualifying reason such as a job relocation, a health condition, or an unforeseeable event. The ceiling is prorated by qualifying months over 24, applied to the full $250,000 or $500,000.
Do both spouses have to meet the two-year test?
At least one spouse must meet the ownership test, but both must meet the use test for the full $500,000. If only one lived there, the exclusion drops to that spouse's $250,000 share.
Is the exclusion a deduction?
No, it is an exclusion from income, which is more valuable. Excluded gain never enters your income, so it cannot push you into a higher bracket or trigger phaseouts.
Do I have to report the sale if I owe nothing?
Only if you received Form 1099-S or cannot exclude the full gain. When a settlement agent reports proceeds, the sale goes on Form 8949 and Schedule D with the exclusion entered as a code.
What if I inherited the house?
Inherited property generally gets a stepped-up basis equal to fair market value at the date of death, erasing gain that accrued during the prior owner's life. Gifts do not receive a step-up.
Disclaimer: This calculator estimates federal tax for general information and is not tax, legal, or financial advice. It does not model net investment income tax thresholds precisely, state income tax, alternative minimum tax, instalment sales, or the depreciation-adjusted limit for rental periods after 2008. Confirm with IRS Publication 523 and a licensed tax professional.
Related: Home office deduction · Rental property tax · Mortgage interest deduction · All home tax tools