🏡
✓ Editorially reviewed by Derek Giordano, Founder & Editor · BA Business Marketing

Home Sale Tax Calculator

Section 121 exclusion, partial exclusions, rental periods and depreciation recapture

Updated October 2026

🧮
700+ calculators, no signup required
Finance · Health · Math · Science · Business
nnng.com
Gain on a home sale = sale price − selling costs − (purchase price + improvements − depreciation); up to $250,000 of it ($500,000 for a married couple filing jointly) is tax-free if you owned and lived in the home 2 of the last 5 years. A couple who bought for $300,000, added $40,000 of improvements and sold for $850,000 with $45,000 of selling costs has a $465,000 gain, all excluded: Taxable gain $0 of $465,000 total. Moving early for a job, health or an unforeseen event can still earn a partial exclusion: months qualified ÷ 24 × $250,000.

What to Enter

Sale price is the contract price from your closing statement (also on Form 1099-S if you got one). Selling costs are commissions, title and legal fees and transfer taxes you paid. Purchase price plus buying costs includes the settlement fees Publication 523 lets you add to basis, such as title fees and recording fees. Capital improvements are additions that add value or extend the home’s life (a new roof, an addition, central air), not repairs. Depreciation is any you took, or could have taken, for a home office or rental use after May 6, 1997. If you rented the home out before living in it, enter those months as nonqualified use and your total months of ownership.

How the Taxable Gain Is Calculated: a Worked Example

The couple’s amount realized is $850,000 − $45,000 = $805,000. Their adjusted basis is $300,000 + $40,000 = $340,000. Gain: $805,000 − $340,000 = $465,000. They both lived there for at least 2 of the last 5 years and one of them owned it that long, so the limit is $500,000 and the full $465,000 is excluded. A single owner in the same house would exclude $250,000 and owe tax on $215,000.

When there is depreciation or a rental period, the order follows Worksheet 3 in Publication 523: subtract depreciation from the gain first (it is taxed as unrecaptured section 1250 gain), then take out the share of the remaining gain that belongs to nonqualified use, and apply the exclusion only to what is left.

Four Sales Compared

SituationGainExclusion limitExcludedTaxable (incl. recapture)Est. federal tax at 15%
Couple, bought for $300,000 in 2012, sells for $850,000$465,000$500,000$465,000$0$0
Single owner, $410,000 gain$410,000$250,000$250,000$160,000$24,000
Single, job move after 14 months, $90,000 gain$90,000$145,833$90,000$0$0
Former rental: 2 of 5 years rented, $20,000 depreciation (Pub 523 Finley)$320,000$250,000$180,000$140,000$23,000

The job-move seller qualifies for 14 ÷ 24 of $250,000, or $145,833, more than the $90,000 gain, so nothing is taxed. The former rental matches Publication 523’s Finley example: 2 of 5 years rented makes 40% of the $300,000 gain after depreciation ($120,000) taxable, and the $20,000 of depreciation is recaptured.

Eligibility Rules and Limits

Ownership: you owned the home at least 24 months in the 5 years before the sale. Residence: you lived in it as your main home at least 24 months (730 days) in that period; the months need not be consecutive. Look-back: you did not exclude gain on another home sold in the 2 years before this sale. A married couple filing jointly gets $500,000 if either spouse meets the ownership test, both meet the residence test and neither used the exclusion in the prior 2 years. A surviving spouse can still use $500,000 for a sale within 2 years of the spouse’s death if they have not remarried. The $250,000 and $500,000 limits are not indexed for inflation.

The Partial Exclusion for Early Moves

If you fail the 2-year tests mainly because of a change in workplace (a new job at least 50 miles farther from the home than the old one), a health reason, or an unforeseeable event (Publication 523 lists examples such as a death, a divorce or legal separation, becoming eligible for unemployment compensation, and twins or more from one pregnancy), you get a reduced limit. Take the shortest of your residence time in the last 5 years, your ownership time, and the time since you last used the exclusion; divide by 24 months (or 730 days) and multiply by $250,000. A joint filer does this for each spouse and adds the results; this calculator assumes both spouses have the same period.

Rental Periods, Home Offices and Recapture

Any depreciation allowed or allowable after May 6, 1997 is taxed when you sell, at a rate of up to 25%, even if the rest of the gain is excluded. Periods after 2008 when nobody used the home as a main residence are nonqualified use, and that share of the gain is taxable, except for time after you moved out within the 5-year window, up to 10 years of qualified official extended duty, and up to 2 years of temporary absence for work, health or unforeseen reasons.

Home Sale Tax Mistakes

Counting repairs as improvements. Painting and fixing a leak do not add to basis; a new roof does. Losing improvement records, which leaves you unable to prove a higher basis. Ignoring depreciation you never claimed on a former rental: the "allowable" rule can still apply. Assuming a married couple always gets $500,000 when only one spouse lived there. Thinking a loss is deductible: a loss on a personal residence is not. Skipping Form 8949 when a 1099-S was issued, even if all the gain is excluded.

What This Calculator Does Not Cover, and When to Get Help

It does not split a home with a separate business structure, handle divorce transfers, 1031 exchanges, military "stop the clock" periods, inherited homes (stepped-up basis), state income tax, or the 3.8% net investment income tax that can apply to taxable gain at higher incomes. The tax estimate uses a single capital gains rate you choose, not your full return. A tax professional is worth it for a former rental, a partial exclusion, or a sale with a large taxable gain.

Frequently Asked Questions

How is capital gains tax on a home sale calculated?
Subtract selling costs and your adjusted basis (purchase price plus improvements minus depreciation) from the sale price, then subtract the exclusion. Only the remainder is taxed, at long-term capital gains rates if you owned the home more than a year.
How long do I have to live in a house to avoid capital gains?
At least 24 months of the 5 years before the sale, and you must have owned it that long. Shorter stays can still get a partial exclusion if you moved for work, health or an unforeseen reason.
Do I have to buy another house to avoid capital gains?
No. The exclusion applies whether or not you buy another home.
Is the home sale exclusion $500,000 for married couples?
Yes, if you file jointly, either spouse meets the ownership test, both meet the residence test, and neither excluded gain on another home in the prior 2 years.
Can I use the exclusion more than once?
Yes, but not more than once in any 2-year period.
What if I get a Form 1099-S?
Report the sale on Form 8949 and Schedule D even if the whole gain is excluded; Publication 523 says you may need Form 8949 when a 1099-S was received.
Is depreciation on a home office taxed when I sell?
Yes. Depreciation after May 6, 1997 is not covered by the exclusion and is taxed at up to 25%.

How to Use This Calculator

  1. Enter the sale — price and selling costs from the closing statement.
  2. Enter your basis — purchase price with buying costs, improvements, and any depreciation.
  3. Answer the eligibility test — full, partial or none, plus any rental months.
  4. Read the result — gain, exclusion, taxable gain and an estimate of the tax.
📚 Sources & References
  1. [1] IRS. Publication 523, Selling Your Home (2025 edition, revised Feb 2026): eligibility test, Worksheets 1 to 3, Finley example (accessed Oct 2026). www.irs.gov
  2. [2] IRS. Topic no. 701, Sale of your home (accessed Oct 2026). www.irs.gov
  3. [3] IRS. Publication 587, Business Use of Your Home (2025 edition): depreciation after May 6, 1997 on sale. www.irs.gov
✅ Editorial Standards — Every calculator is built from peer-reviewed formulas and official data sources, editorially reviewed for accuracy, and updated regularly. Read our full methodology · About the author