Capital Gains Exclusion Calculator
Section 121 home sale exclusion, taxable gain, and estimated federal tax.
What it does
Section 121 of the Internal Revenue Code lets a homeowner exclude some or all of the gain from selling a main home. The full limit is $250,000 for a single filer and $500,000 for a married couple filing jointly. The limit applies to the gain, not to the sale price, and the home must meet ownership and use tests.
The tests are often called the two-of-five rule. During the five years ending on the sale date, you must have owned the home for at least two years and lived in it as your main home for at least two years. The two years do not have to be the same two years, and they do not have to be consecutive. You also cannot have claimed the exclusion on another home sale within the two years before this sale.
Gain is the sale price minus the adjusted basis minus selling costs. The adjusted basis starts with what you paid and grows with capital improvements, such as a new roof or an addition. It shrinks with depreciation, such as a home office deduction, and with any gain that was already excluded. Selling costs include commissions, title, escrow, transfer taxes, and advertising. Routine repairs and maintenance do not add to basis.
A short stay can still get a partial exclusion if the sale was caused by a change in workplace location, a health condition, or an unforeseen event. The partial limit is the full limit multiplied by the shortest of three periods: time owned, time used as the main home, and time since the last exclusion. That period is divided by 730 days and capped at the full limit. The calculator uses the same 730-day measure and applies the reason you select.
The default example is a married couple with a $900,000 sale, a $320,000 basis, and $55,000 of selling costs. The gain is $525,000. The full $500,000 exclusion leaves $25,000 taxable, and at a 15 percent rate the estimated federal tax is $3,750. The result is an estimate, not a tax return. Depreciation recapture, state income tax, the 3.8 percent net investment income tax, and any alternative minimum tax are outside this page.
How to use
- Choose the filing status that matches the tax return for the year of the sale.
- Enter the gross sale price before the mortgage payoff and before selling costs.
- Enter the adjusted basis. Start with the purchase price, add capital improvements, and subtract depreciation.
- Enter selling costs that are directly tied to the sale, not routine repairs.
- Enter days owned, days lived in the home, and days since the last exclusion. Use 1,826 or more for five years or for never.
- Pick a short-stay reason only if it applies, then read the exclusion, taxable gain, and estimated tax.
Formula
- sale price
- Gross contract price before selling costs and before the loan payoff.
- adjusted basis
- Purchase price plus capital improvements minus depreciation and prior excluded gain.
- selling costs
- Commission, title, escrow, transfer tax, and advertising directly tied to the sale.
- qualifying days
- The shortest of days owned, days lived in the home, and days since the last exclusion.
- exclusion
- The amount of gain removed from income, up to the filing-status limit.
- taxable gain
- Gain left after the exclusion, before state tax and surtaxes.
The 730-day denominator is two years. A full exclusion requires all three periods to reach 730 days and no exclusion in the prior two years. A partial exclusion uses the shortest period, so a sale after 365 days of ownership and use gets one half of the full limit, provided a qualifying reason applies. The partial exclusion cannot exceed the full limit, even if the shortest period is longer than 730 days. The tax rate is the long-term federal rate you enter; it is not a bracket calculation. Depreciation taken after May 6, 1997 is recaptured at a different rate and is not eligible for the exclusion, so add it back before comparing the result with tax software.
Worked example
Example: $900,000 sale with a $500,000 exclusion
A married couple sells their main home for $900,000. Their adjusted basis is $320,000, selling costs are $55,000, and they have owned and lived in the home for more than two years.
- Gain = 900,000 - 320,000 - 55,000 = $525,000.
- The couple files jointly, so the full exclusion is $500,000.
- All three periods are at least 730 days and no exclusion was used in the prior two years, so the full limit applies.
- Taxable gain = 525,000 - 500,000 = $25,000.
- Estimated federal tax at 15 percent = 25,000 x 0.15 = $3,750.
- The remaining $25,000 is still reportable, and state tax or the net investment income tax may add to the bill.
Reference table
| Gain | Exclusion | Taxable gain | Estimated tax |
|---|---|---|---|
| $400,000 | $500,000 | $0 | $0 |
| $500,000 | $500,000 | $0 | $0 |
| $525,000 | $500,000 | $25,000 | $3,750 |
| $650,000 | $500,000 | $150,000 | $22,500 |
| $800,000 | $500,000 | $300,000 | $45,000 |
Limits
- Does not calculate depreciation recapture, state income tax, the 3.8 percent net investment income tax, or the alternative minimum tax.
- Assumes the home qualifies as a main home and that no exclusion was claimed in the prior two years.
- Uses a flat tax rate instead of the actual bracket and phase-in rules for capital gains.
- Does not verify basis records, improvement receipts, or the dates used for the two-of-five test.
Common mistakes
- Subtracting the exclusion from the sale price instead of from the gain.
- Forgetting selling costs, which reduce gain even though they are not part of basis.
- Adding routine repairs to basis instead of reserving basis for capital improvements.
- Counting two years as 24 months without checking the actual day count.
- Claiming the full exclusion after a recent home sale that already used it.
- Ignoring depreciation recapture from a home office or rental period.
Try it yourself
Quick checks. Answers sit tucked under each question.
A single filer sells for $600,000 with a $250,000 basis and $30,000 of selling costs. What is the tax at 15 percent?
Gain = 600,000 - 250,000 - 30,000 = $320,000. Exclusion = $250,000. Taxable gain = $70,000. Tax = $10,500.
A married couple sells for $800,000 with a $400,000 basis and $50,000 of costs. What is the taxable gain?
Gain = 800,000 - 400,000 - 50,000 = $350,000. The $500,000 exclusion covers all of it, so taxable gain is $0.
A single filer has a $300,000 gain, 365 days of ownership and use, and a qualifying health reason. What is the exclusion?
The shortest period is 365 days. Exclusion = 250,000 x 365 / 730 = $125,000. Taxable gain = $175,000, and tax at 15 percent is $26,250.
Questions
What is the difference between the $250,000 and $500,000 limits?
The $500,000 limit applies to a married couple filing a joint return. The $250,000 limit applies to a single filer or a married person filing separately.
Do I have to buy another home to use the exclusion?
No. The exclusion does not require a replacement purchase. You do have to meet the ownership, use, and prior-sale tests.
What counts as an unforeseen event?
IRS Publication 523 lists events such as a natural disaster, a change in employment, a death, or a multiple birth that makes the home unsuitable. The list is specific, so read the publication before relying on this reason.
Can I use a partial exclusion without a special reason?
No. A partial exclusion requires a qualifying work, health, or unforeseen event reason. Without one, a short stay generally gets no exclusion.
Is the exclusion based on the sale price or the gain?
It is based on the gain. A $900,000 sale with a $500,000 exclusion does not mean $500,000 of the price is tax free; it means up to $500,000 of gain is excluded.
How is the two-year period counted?
The ownership and use tests look at the five years ending on the sale date. You need at least two years of ownership and two years of main-home use within that window, and the periods do not have to match.