Selling Your Home: How Federal Capital Gains Tax Works
Posted in :
A high sale price doesn’t automatically mean you owe capital gains tax. The federal capital gains tax home sale rules look at your gain, whether the property was your main home, and how you used it.
This article covers U.S. federal tax rules. State and local rules may differ. The calculation starts with the amount realized and your adjusted basis, then accounts for any exclusion you qualify for.
Key Takeaways
- The home-sale exclusion may let eligible homeowners exclude up to $250,000 of gain, or up to $500,000 for some married couples filing jointly.
- Generally, you must have owned and used the home as your main home for at least two years within the five years before the sale.
- Your gain is generally the amount realized from the sale minus your adjusted basis. It is not the same as your closing check.
- Rental or business use can leave some gain taxable, especially when depreciation was allowed or allowable.
- A personal-use home sale at a loss generally doesn’t create a deductible tax loss.
Capital Gains Tax Home Sale Rules: When the Exclusion Applies
The federal exclusion generally applies to a qualifying main home, not automatically to a second home or investment property. The IRS explains the rules in Publication 523, Selling Your Home.
Ownership and use tests
In general, you must meet two tests during the five-year period ending on the sale date:
- You owned the home for at least 24 months.
- You used it as your main home for at least 24 months.
The 24 months don’t have to be continuous. The ownership and use periods can be different, as long as each requirement is met within the five-year period.
You also generally can’t have excluded gain from another home sale during the two years before this sale. If you’re unsure whether a prior sale affects your eligibility, check the dates and facts before filing.
Exclusion limits and special cases
An eligible individual can generally exclude up to $250,000 of gain. Some married couples filing jointly can exclude up to $500,000. To qualify for the full joint exclusion, both spouses must meet the use test, and at least one must meet the ownership test. Other conditions apply, including the two-year rule for prior exclusions.
You may qualify for a reduced exclusion if you sell earlier than planned because of a qualifying change in employment location, health, or an unforeseen circumstance. The facts matter. Don’t assume an early sale automatically qualifies.
How to Calculate Gain on a Home Sale
The basic calculation is straightforward:
Amount realized − adjusted basis = gain
The result is your gain before applying the exclusion or accounting for other tax rules. The IRS provides worksheets in Publication 523.
Start with the amount realized
The amount realized is generally the sale price, reduced by eligible selling expenses. Those expenses may include a real estate commission and certain title or legal fees connected with the sale.
Your mortgage payoff does not reduce your gain. It affects the cash you receive at closing, but it isn’t the same as a selling expense for this calculation. The same is true of other debts or liens paid from the proceeds.
Adjust your basis for qualifying costs
Your basis generally starts with what you paid for the home. Certain costs tied to buying it may also count. Over time, qualifying capital improvements can increase your adjusted basis.
An improvement generally adds lasting value, adapts the home to a new use, or extends its useful life. A major addition or substantial renovation may qualify. Routine repairs and maintenance, such as fixing a leak or repainting, generally don’t increase basis.
Keep purchase documents, invoices, permits, and records of major work. If you can’t support an improvement with records, it may be harder to include its cost in your basis.
Example: Sale Proceeds Aren’t the Taxable Gain
Suppose you sell a home and your amount realized is $700,000. Your adjusted basis is $400,000. Your gain before any exclusion is $300,000.
If you’re an eligible individual, you may exclude up to $250,000, leaving up to $50,000 not excluded. If you qualify for the full $500,000 joint exclusion, the $300,000 gain may fall within that limit, subject to the other rules.
This is a simplified example. Selling expenses, improvements, rental or business use, and other facts can change the calculation. The $700,000 amount also isn’t the same as the cash you take home. A mortgage payoff and other closing deductions can reduce that cash without reducing the taxable gain.
Rental or Business Use Can Change the Tax Treatment
Using part or all of a home for rental or business purposes can affect the calculation. The home-sale exclusion may still apply to eligible gain, but it doesn’t erase every tax consequence.
Depreciation may remain taxable
If you claimed depreciation, or could have claimed it, for rental or business use after May 6, 1997, the gain tied to that depreciation generally can’t be excluded under the home-sale exclusion. This can apply even when you otherwise meet the ownership and use tests.
Depreciation is based on tax rules, not only on whether you took a deduction on a return. The IRS describes the rental-property limits in its guidance on depreciation and the home-sale exclusion. If the home was rented, see how depreciation recapture rules for rental property apply to that part of the gain.
Separate use can require a closer review
A home office, a rented room, or a separate unit may affect which parts of the gain qualify for exclusion and how depreciation is handled. The result depends on how the space was used, how it was reported, and whether it was part of the home or a separate living unit.
If you rented out the whole property after living there, the timing still matters. You might meet the main-home tests and also have gain related to depreciation that remains taxable. Keep rental records and prior tax returns for the calculation.
Reporting the Sale and Keeping Records
Whether you need to report the sale depends on the tax result and the forms you receive. The IRS explains the general reporting rules in its page about Publication 523 and home-sale reporting.
Check for Form 1099-S
If you receive Form 1099-S, you must report the sale even if you believe all of the gain is excludable. If some gain is taxable, the IRS generally directs taxpayers to report it on Form 8949 and Schedule D, following the form instructions.
If you don’t receive Form 1099-S and all of your gain qualifies for exclusion, you may not need to report the sale. Your specific reporting duty can depend on the facts, so review the current IRS instructions.
Keep records that support the calculation
Save the closing statement, purchase records, invoices for qualifying improvements, and any documents showing how you used the property. If it was rented or used for business, keep depreciation schedules and related tax returns.
A loss on a personal-use home generally isn’t deductible. That rule is separate from whether you have to report the sale for another reason, such as receiving Form 1099-S.
State and Local Rules May Differ
The federal exclusion doesn’t settle every state or local tax question. States may use different rules or calculations, and local requirements may also apply. Check the rules where the home is located, especially if you moved across state lines or had rental income.
The federal calculation is a starting point, not a complete tax estimate. A qualified tax professional can review your purchase records, improvements, occupancy dates, prior exclusions, and any rental or business use.
What If a Spouse Dies Before the Home Is Sold?
A surviving spouse who doesn’t meet both two-year tests alone may still qualify for the full $500,000 exclusion. IRS Publication 523 sets out the conditions: the home must generally be sold within two years of the spouse’s death, the surviving spouse must not have remarried before the sale, and neither spouse can have excluded gain from another home sale during the two years before this one.
For the ownership and use tests, time the late spouse spent owning and living in the home can count. Keep the deed, the death certificate, and records of how the home was used, and have a tax professional confirm the calculation before you file.
FAQ
Do I pay tax on the full sale price?
No. Federal capital gains tax generally applies to taxable gain, not the full sale price. The calculation starts with the amount realized and subtracts your adjusted basis. The eligible home-sale exclusion may reduce the remaining gain.
Can I claim the exclusion if I lived in the home for two years but owned it for less?
Generally, you must meet both the ownership and use tests. Each requires at least 24 months within the five-year period before the sale. A reduced exclusion may be available in some qualifying circumstances, but it isn’t automatic.
Does a new roof increase my home’s basis?
A major replacement may qualify as a capital improvement and increase basis. A patch or routine repair generally doesn’t. Keep the invoice and supporting records, then confirm how the work should be treated for your circumstances.
What if I sold the home at a loss?
A loss on a personal-use residence generally isn’t deductible on your federal return. If the property had rental or business use, different rules may apply to that portion.
Make the Calculation Before You File
Your closing proceeds and your taxable gain are different numbers. Start with the amount realized, subtract your adjusted basis, then check the main-home exclusion and any rental or business-use rules.
Keep the records that support each number. If your situation includes depreciation, a prior home-sale exclusion, or uncertain improvements, ask a qualified tax professional to review it before filing.

