Home Sale Capital Gains Calculator (Section 121 Exclusion)

Generally, up to $250,000 of the gain on the sale of a main home can be excluded from income, or up to $500,000 on a joint return, if the ownership and use tests are met (IRS Topic no. 701; 26 U.S.C. 121). The calculator below takes the sale price, selling costs, purchase price, improvements and depreciation, applies that limit, and shows the taxable gain, the part depreciation keeps out of the exclusion, and where the rest falls on the capital gains rate bands. It also computes the reduced exclusion with the formula Publication 523 gives.

Maintained by Archie Chang · Reviewed November 15, 2026 · Methodology & sources

Not tax advice. FedRateCalc is independent and is not affiliated with the Internal Revenue Service, the U.S. Congress or any state tax office; each agency’s own site is authoritative. The calculator follows the IRS worksheets for the common case only. It is not an estimate of a tax bill, and special rules can change the result, so the IRS publication and the statute quoted below are the reference for a particular sale. The filing-status and tax-year choices only select which capital gains thresholds are read.

Your home sale

$
$
$
$
$
$

The starting numbers are an example. Replace them with yours.

Gain, exclusion and taxable gain

Taxable gain after the exclusion

$0.00

You meet the residence, ownership and look-back requirements.

Gain and exclusion, line by line
Selling price$700,000.00
Less selling costs($42,000.00)
Amount realized$658,000.00
Purchase price plus improvements$450,000.00
Less depreciation claimed$0.00
Adjusted basis$450,000.00
Gain or (loss)$208,000.00
Exclusion limit that applies$250,000.00
Gain that depreciation keeps out of the exclusion$0.00
Exclusion used($208,000.00)
Taxable gain$0.00

The exclusion and the tests

IRS Topic no. 701 states the amounts and the two tests:

“If you have a capital gain from the sale of your main home, you may qualify to exclude up to $250,000 of that gain from your income, or up to $500,000 of that gain if you file a joint return with your spouse.”
IRS, Topic no. 701, Sale of your home (fetched November 3, 2026)
“In general, to qualify for this exclusion, you must meet both the ownership test and the use test. If you are filing jointly with your spouse, either you or your spouse must meet the ownership test while both you and your spouse must meet the use test individually.”
IRS, Topic no. 701, Sale of your home (fetched November 3, 2026)

The calculator takes the 2-of-5 tests as months owned and months lived in the home within the 60 months before the sale, and treats 24 months as meeting each. The once-every-2-years rule, in Publication 523 (2025) and the statute, is a checkbox:

“Determine whether you meet the look-back requirement. If you didn't sell another home during the 2-year period before the date of sale (or if you did sell another home during this period but didn't take an exclusion of the gain earned from it), you meet the look-back requirement. You may take the exclusion only once during a 2-year period.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

The statute gives the limits:

“The amount of gain excluded from gross income under subsection (a) with respect to any sale or exchange shall not exceed $250,000.”
26 U.S.C. 121 (uscode.house.gov) (fetched November 3, 2026)
“In the case of a husband and wife who make a joint return for the taxable year of the sale or exchange of the property— | (A) $500,000 Limitation for certain joint returns | Paragraph (1) shall be applied by substituting “$500,000” for “$250,000” if— | (i) either spouse meets the ownership requirements of subsection (a) with respect to such property; | (ii) both spouses meet the use requirements of subsection (a) with respect to such property; and | (iii) neither spouse is ineligible for the benefits of subsection (a) with respect to such property by reason of paragraph (3).”
26 U.S.C. 121 (uscode.house.gov) (fetched November 3, 2026)

On a joint return the calculator shows the full joint limit when both spouses meet the residence and look-back tests and the ownership entry is 24 months or more. When only one spouse meets all three, it follows the Publication 523 (2025) Worksheet 1 row for married filing jointly:

“Both spouses meet the residence and look-back requirements and one or both spouses meet the ownership requirement. $500,000 Determine if either spouse is eligible for the full limit as a single person. If not, determine if either spouse is eligible for a partial exclusion.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

Here the full limit as a single person is $250,000. A surviving spouse follows other rules, which the capital gains tax on a home sale page covers.

Gain: selling costs, improvements and basis

Publication 523 (2025) describes the arithmetic the calculator uses:

“To figure the gain or loss on the sale of your main home, you must know the selling price, the amount realized, and the adjusted basis. Subtract the adjusted basis from the amount realized to get your gain or loss. | Selling price | − Selling expenses | Amount realized | − Adjusted basis | Gain or loss | A positive number indicates a gain; a negative number indicates a loss.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

On a loss, which the calculator shows as a loss and not as a taxable gain, Publication 523 (2025) says:

“If the number is negative (adjusted basis is greater than amount realized), you sold your home at a loss. You can’t deduct this loss, but you don’t need to pay any tax on the money you received from selling your home. Skip to Reporting Your Home Sale, later. • If the number is positive, you sold your home at a gain. Skip to How Much Is Taxable, later, to see if Worksheet 3 is required. If this is your separate worksheet for business use, don’t follow guidance on line 7. Report the gain on Form 4797 because this gain is not excluded under section 121.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

On selling expenses and the amount realized, with the items between the two parts left out:

“Determine your selling expenses. These are the costs directly associated with selling your home. […] Figure your “amount realized” (sale price minus selling expenses).”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026) The […] marks text of the source that is left out.

On improvements and the adjusted basis:

“Improvements add to the value of your home, prolong its useful life, or adapt it to new uses. You add the cost of additions and improvements to the basis of your property.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)
“Figure your “adjusted basis” (total basis minus basis adjustments).”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

Depreciation is one of the basis adjustments, with the items between the two parts left out. The calculator adds the purchase price and the improvements, takes off the depreciation entered, and uses the result as the adjusted basis. It does not work out the other basis adjustments or the items that Publication 523 (2025) lets a buyer add to basis, so those are entries the reader makes:

“Determine your “basis adjustments” (any payments, credits, or benefits you may need to deduct from your basis). a. Any depreciation you took or were allowed to take for the use of your home for business or rental purposes […] Add lines 5a through 5l. This is your basis adjustment”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026) The […] marks text of the source that is left out.

Depreciation and the exclusion

For a room used as a home office or a rented room inside the home, Publication 523 (2025) says:

“If the part of your property used for business or to produce rental income is within your home, such as a room used as a home office for a business, you do not need to allocate gain on the sale of the property between the business part of the property and the part used as a home. In addition, you do not need to report the sale of the business or rental part on Form 4797. This is true whether or not you were entitled to claim any depreciation. However, you can’t exclude the portion of gain equal to any section 1250(b)(3) depreciation adjustments allowed or allowable after May 6, 1997, which must be recaptured and reported under section 1250.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

Its example, a lawyer who used part of a house as an office:

“Logan claimed depreciation deductions of $2,000 during the period that the house is owned. Logan sells the house in 2016, realizing a gain of $13,000. Logan has no other section 1231 or capital gains or losses for 2016. Logan must recognize $2,000 of the gain as unrecaptured section 1250 gain.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

The statute says the same for depreciation after May 6, 1997:

“(6) Recognition of gain attributable to depreciation | Subsection (a) shall not apply to so much of the gain from the sale of any property as does not exceed the portion of the depreciation adjustments (as defined in section 1250(b)(3)) attributable to periods after May 6, 1997, in respect of such property.”
26 U.S.C. 121 (uscode.house.gov) (fetched November 3, 2026)

The calculator takes the smaller of the gain and the depreciation entered as the part of the gain that cannot be excluded. For the tax rate on that part, IRS Topic no. 409 says:

“The portion of any unrecaptured section 1250 gain from selling section 1250 real property is taxed at a maximum 25% rate.”
IRS, Topic no. 409, Capital gains and losses (fetched November 1, 2026)

The calculator reports that part on its own line and does not stack it on the rate bands.

Reduced (partial) exclusion

Publication 523 (2025) says when a reduced exclusion can apply:

“If you don't meet the Eligibility Test, you may still qualify for a partial exclusion of gain. You can meet the requirements for a partial exclusion if the main reason for your home sale was a change in workplace location, a health issue, or an unforeseeable event.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

It gives the formula in Worksheet 1. The parts of the worksheet between the quoted steps, such as the blank lines for entries, are left out here:

“Step 1 Determine the shortest of the following 3 periods: 1. Your time of residence in the home during the 5-year period leading up to the sale […] 2. Your time of ownership of the home leading up to the sale […] 3. The time that has elapsed between the sale and the date you last sold a home for which you took the exclusion, if applicable […] Step 2 Take the smallest period from Step 1 (you may use days or months) and divide that number by 730 (if using days) or 24 (if using months) […] Step 3 Multiply the result from Step 2 by $250,000. This is the amount of your reduced exclusion. For married filing jointly, continue to step 4. […] Step 4 Repeat Steps 1–3 for your spouse and add the two results”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026) The […] marks text of the source that is left out.

The calculator does steps 1 to 3 for a filing status other than married filing jointly, using months and dividing by 24, when the box for the reason is ticked. It does not decide whether the reason qualifies: Publication 523 (2025) lists the work-related, health-related and unforeseeable events. For a joint return it does not do step 4 and shows no exclusion in that case.

The capital gains rate bands

The 0% and 15% limits are read from the site’s capital gains threshold data, the same data as the capital gains tax calculator and the capital gains tax brackets for 2027. Revenue Procedure 2025-32 (tax year 2026) and Revenue Procedure 2026-35 (tax year 2027) each give them in a table, quoted here down to the row for all other individuals:

“For taxable years beginning in 2026, the maximum zero rate amounts and maximum 15 percent rate amounts under § 1(j)(5)(B), as adjusted for inflation, are as follows: Filing Status Maximum Zero Maximum15% Rate Amount Rate Amount Married Individuals Filing Joint Returns and $98,900 $613,700 Surviving Spouse Married Individuals Filing Separate Returns $49,450 $306,850 Heads of Household $66,200 $579,600 All Other Individuals $49,450 $545,500”
IRS, Revenue Procedure 2025-32, section 4.03 (tax year 2026) (fetched November 4, 2026)
“For taxable years beginning in 2027, the maximum zero rate amounts and maximum 15 percent rate amounts under § 1(j)(5)(B), as adjusted for inflation, are as follows: Filing Status Maximum Zero Maximum15% Rate Amount Rate Amount Married Individuals Filing Joint Returns and $102,100 $633,600 Surviving Spouse Married Individuals Filing Separate Returns $51,050 $316,800 Heads of Households $68,350 $598,400 All Other Individuals $51,050 $563,200”
IRS, Revenue Procedure 2026-35, section 3.03 (tax year 2027) (fetched November 6, 2026)
The same limits by filing status, read from the site’s data
Filing status2026: 0% up to / 15% up to2027: 0% up to / 15% up to
Single$49,450 / $545,500$51,050 / $563,200
Married filing jointly (or qualifying surviving spouse)$98,900 / $613,700$102,100 / $633,600
Married filing separately$49,450 / $306,850$51,050 / $316,800
Head of household$66,200 / $579,600$68,350 / $598,400

For the part above the 15% limit, IRS Topic no. 409 says:

“However, a capital gains rate of 20% applies to the extent that your taxable income exceeds the thresholds set for the 15% capital gain rate.”
IRS, Topic no. 409, Capital gains and losses (fetched November 1, 2026)

The order in which the calculator fills the bands follows the Schedule D Tax Worksheet in the 2025 Instructions for Schedule D, whose dollar amounts are the 2025 ones; the calculator reads the 2026 and 2027 limits above instead. On the worksheet’s lines, the gain in Schedule D lines 18 and 19 is taken out of line 13, line 14 subtracts line 13 from taxable income, and line 22 gives the amount taxed at 0% from line 14. Schedule D line 19 is unrecaptured section 1250 gain, which the instructions describe for real property that was depreciated:

“If you checked “Yes” on line 17, complete the Unrecaptured Section 1250 Gain Worksheet in these instructions if any of the following apply for 2025. […] You sold or otherwise disposed of section 1250 property (generally, real property that you depreciated) held more than 1 year.”
IRS, 2025 Instructions for Schedule D (Form 1040), Line 19 and the Schedule D Tax Worksheet (fetched November 15, 2026) The […] marks text of the source that is left out.
“1. Enter your taxable income from Form 1040, 1040-SR, or 1040-NR, line 15. […] 11. Add lines 18 and 19 of Schedule D […] 12. Enter the smaller of line 9 or line 11 […] 13. Subtract line 12 from line 10 […] 14. Subtract line 13 from line 1. If zero or less, enter -0- […] 16. Enter the smaller of line 1 or line 15 […] 17. Enter the smaller of line 14 or line 16 […] 22. Subtract line 17 from line 16. This amount is taxed at 0%”
IRS, 2025 Instructions for Schedule D (Form 1040), Line 19 and the Schedule D Tax Worksheet (fetched November 15, 2026) The […] marks text of the source that is left out.

So the calculator counts the other taxable income and the depreciation part of the gain first, which use up the 0% room, and puts the rest of the taxable gain on the 0%, 15% and 20% bands after them. It does not apply the worksheet’s lines 35 to 40, which figure the 25% amount.

What the calculator does not model

Nonqualified use, the periods after 2008 when a home was not a main home, is not modelled. The statute treats it this way:

“(5) Exclusion of gain allocated to nonqualified use | (A) In general | Subsection (a) shall not apply to so much of the gain from the sale or exchange of property as is allocated to periods of nonqualified use.”
26 U.S.C. 121 (uscode.house.gov) (fetched November 3, 2026)
“(C) Period of nonqualified use | For purposes of this paragraph— | (i) In general | The term “period of nonqualified use” means any period (other than the portion of any period preceding January 1, 2009) during which the property is not used as the principal residence of the taxpayer or the taxpayer’s spouse or former spouse. | (ii) Exceptions | The term “period of nonqualified use” does not include— | (I) any portion of the 5-year period described in subsection (a) which is after the last date that such property is used as the principal residence of the taxpayer or the taxpayer’s spouse, | (II) any period (not to exceed an aggregate period of 10 years) during which the taxpayer or the taxpayer’s spouse is serving on qualified official extended duty (as defined in subsection (d)(9)(C)) described in clause (i), (ii), or (iii) of subsection (d)(9)(A), and | (III) any other period of temporary absence (not to exceed an aggregate period of 2 years) due to change of employment, health conditions, or such other unforeseen circumstances as may be specified by the Secretary.”
26 U.S.C. 121 (uscode.house.gov) (fetched November 3, 2026)

A separate structure used for business or rental is not modelled either. Publication 523 (2025) says:

“You generally can’t exclude gain on the separate portion of your property used for business or to produce rental income. Regulations section 1.121-1(e) provides that the use of a separate portion of your home for business or rental purposes doesn’t qualify for exclusion under section 121, and this may affect your gain or loss calculations.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

The automatic disqualifications that Publication 523 (2025) puts first, a like-kind exchange within the past 5 years and expatriate tax, are not checked either:

“Determine whether any of the automatic disqualifications apply. Your home sale isn’t eligible for the exclusion if ANY of the following are true. • You acquired the property through a like-kind exchange (section 1031 exchange) during the past 5 years. See Pub. 544, Sales and Other Dispositions of Assets. • You are subject to expatriate tax. For more information about expatriate tax, see chapter 4 of Pub. 519, U.S. Tax Guide for Aliens. If any of these conditions are true, the exclusion doesn’t apply. Skip to Figuring Gain or Loss, later.”
IRS, Publication 523 (2025), Selling Your Home (fetched November 3, 2026)

It also does not apply state income tax, the net investment income tax, installment sales, or the other special rules in Publication 523 (2025). The Medicare surcharge page covers how the taxable part of a gain is counted in income for Medicare premiums.

Which tax year these rules are from

The tests, the limits, the worksheets and the example above are from Publication 523 (2025), the edition posted at irs.gov/pub/irs-pdf/p523.pdf when we checked on November 15, 2026; its title page and footer read “Publication 523 (2025)”, “Catalog Number 15044W” and “Feb 26, 2026”. For tax year 2026, the statute is the text on uscode.house.gov, which says:

“Text contains those laws in effect through Public Law 119-142 (November 10, 2026).”
U.S. Code, 26 U.S.C. 121, read again (uscode.house.gov, text current through Public Law 119-142, November 10, 2026) (fetched November 15, 2026)

That text gives the same $250,000 and $500,000 limits quoted above. The capital gains thresholds are from the revenue procedures quoted above for tax years 2026 and 2027, and the order of the bands is from the 2025 Instructions for Schedule D.

Frequently asked questions

How much of a home sale gain can be excluded?

Up to $250,000, or up to $500,000 on a joint return, if the conditions are met. IRS Topic no. 701 says a person “may qualify to exclude up to $250,000 of that gain from your income, or up to $500,000 of that gain if you file a joint return with your spouse”, and 26 U.S.C. 121(b)(1) says the amount excluded “shall not exceed $250,000”.

Does depreciation on a home office or rented room change the exclusion?

For space within the home, Publication 523 (2025) says “you can’t exclude the portion of gain equal to any section 1250(b)(3) depreciation adjustments allowed or allowable after May 6, 1997”. The calculator treats the smaller of the gain and the depreciation entered as the part that cannot be excluded. It does not model a separate structure or a period when the home was not a main home.

How is a reduced (partial) exclusion figured?

Publication 523 (2025) Worksheet 1 divides the smallest of three periods by 24 months and multiplies the result by $250,000: “Step 3 Multiply the result from Step 2 by $250,000. This is the amount of your reduced exclusion.” The calculator applies steps 1 to 3 when the sale was made for a workplace change, a health issue or an unforeseeable event, and does not compute step 4 for a joint return.

Which capital gains rate applies to the taxable part of a home sale gain?

The calculator places the taxable gain, other than any depreciation part, on the 0%, 15% and 20% bands in the site's capital gains threshold data for tax year 2026 or 2027. It follows the order of the Schedule D Tax Worksheet in the 2025 Instructions for Schedule D: line 14 subtracts line 13 from taxable income, and line 22 figures the amount taxed at 0% from line 14, so the other taxable income and the depreciation part come before the rest of the gain. For unrecaptured section 1250 gain, IRS Topic no. 409 says “The portion of any unrecaptured section 1250 gain from selling section 1250 real property is taxed at a maximum 25% rate.” The calculator reports that part separately and does not stack it.

Related pages

Sources

Every quotation here is word for word from a copy of the document fetched directly from the agency’s own website, on the date shown next to each source.

28 quotations on this page are word for word from these sources.