Capital Gains on a Home Sale and How the Exclusion Works
You sold the house, the closing statement shows a number far bigger than what you paid, and now you are wondering how much of that profit the IRS expects to see.

You sold the house, the closing statement shows a number far bigger than what you paid, and now you are wondering how much of that profit the IRS expects to see. For most sellers, capital gains on a home sale come to zero tax, but the people who do owe are often surprised, and the difference usually comes down to records they could have kept years ago.
This guide covers the federal rules in the United States: how the gain is calculated, how the primary residence exclusion works, what happens when you fall short of it, and the paperwork worth assembling before you list. It is general information, not tax advice, and a CPA should look at anything close to the limits.
How capital gains on a home sale are calculated
The gain is not the sale price minus the purchase price. It is the amount realized minus your adjusted basis, and both numbers are usually friendlier than people expect.
- Amount realized is the sale price minus selling costs: agent commission, title and escrow fees you paid as seller, transfer taxes and legal fees.
- Adjusted basis is what you paid, plus most closing costs from the purchase, plus the cost of capital improvements, minus any depreciation you claimed for a home office or rental use.
Capital improvements are things that add value, extend the home's life or adapt it to a new use: a new roof, a kitchen remodel, an addition, central air, a fence, new windows. Repairs and maintenance, like repainting a bedroom or fixing a dripping tap, do not count. If you are weighing whether to replace a roof before selling, note that the cost goes into your basis as well as into the listing.
The $250,000 and $500,000 exclusion
Section 121 of the tax code lets you exclude up to $250,000 of gain from income, or up to $500,000 if you are married filing jointly. To qualify you generally need to pass three tests:
- Ownership: you owned the home for at least 2 of the 5 years before the sale.
- Use: you lived in it as your main home for at least 2 of those 5 years. The two years do not have to be continuous, and they do not have to line up exactly with the ownership period.
- Frequency: you have not used the exclusion on another home sale in the 2 years before this one.
For the $500,000 joint figure, either spouse can meet the ownership test, but both must meet the use test and neither can have used the exclusion in the past 2 years. If only one spouse qualifies on use, the couple's limit is generally $250,000.
If you sell before two years
Selling early does not always mean losing the exclusion. If the main reason was a job change that moves you at least 50 miles further away, a health issue, or an unforeseen event such as divorce, a death in the family or multiple births from one pregnancy, you may qualify for a partial exclusion. The amount is prorated: live there 12 months out of the required 24 and a single filer can exclude up to $125,000.
A worked example with real numbers
A married couple bought a house in 2009 for $310,000 and paid $6,000 in qualifying closing costs. Over the years they spent $48,000 on a kitchen remodel and $14,000 on a new roof. In 2026 they sell for $1,050,000, paying a 5.5 percent commission of $57,750 and $8,000 in other seller costs.
| Item | With records | Without improvement records |
|---|---|---|
| Amount realized | $984,250 | $984,250 |
| Adjusted basis | $378,000 | $316,000 |
| Gain | $606,250 | $668,250 |
| Exclusion | $500,000 | $500,000 |
| Taxable gain | $106,250 | $168,250 |
| Federal tax at 15 percent | $15,937.50 | $25,237.50 |
The receipts for a kitchen and a roof were worth $9,300 in federal tax alone, before any state tax. Long-term gains are taxed at 0, 15 or 20 percent depending on income, and higher earners may also owe the 3.8 percent net investment income tax on the taxable portion.
Why "you won't owe anything" is risky advice
Sellers hear this constantly, often from friends who sold in a flatter market: the exclusion is so large you do not need to track basis. For a lot of households it turns out to be true. I still push back on it, for three reasons.
First, long ownership in a rising market blows through the limits. A home bought for $400,000 in 2012 in a coastal city can easily sell for $1.2 million now, and the $250,000 and $500,000 figures have not been adjusted for inflation since they were set in 1997. Second, life changes. A divorce, the death of a spouse or a few years of renting the place out can shrink your exclusion in ways you cannot predict when you sign the purchase contract. Third, a few states handle home sale gains differently from the federal rules, so the state bill may not follow the federal one.
Keeping a folder of invoices costs nothing. Rebuilding 15 years of renovation costs from memory, with an examiner asking for proof, costs a lot.
What to gather before you list
The time to sort this out is before you agree on a price, because the numbers affect how you think about pricing a home right the first time and how you compare net proceeds between offers.
- Your original closing statement from the purchase.
- Invoices, contracts and permits for every improvement, sorted by year.
- Records of any depreciation claimed for a home office or a rental period.
- The dates you lived in the home, especially if you rented it out or moved for work.
- The new closing statement, which shows commission and seller costs line by line.
After closing, the title company may issue Form 1099-S. If your gain is fully covered by the exclusion and you meet the rules, you often do not need to report the sale at all. If part of the gain is taxable, or you received a 1099-S, you report it on Form 8949 and Schedule D.
Rental and home office use
Any depreciation you claimed, or were entitled to claim, after May 6, 1997 cannot be excluded. It is taxed as unrecaptured section 1250 gain at a maximum rate of 25 percent. Periods after 2008 when the home was not your main residence can also reduce the exclusion, which catches people who rented out a house for several years and then moved back in shortly before selling.
Frequently asked questions
Do I pay capital gains if I buy another house?
Buying a replacement home no longer shields the gain; that rollover rule ended in 1997. Today the exclusion is what protects most sellers, and it applies whether or not you buy again.
Can I count closing costs in my basis?
Many purchase closing costs, such as title insurance, recording fees and transfer taxes you paid as buyer, add to your basis. Costs tied to the loan, like points and mortgage insurance, generally do not. Your closing costs as seller reduce the amount realized instead.
What if I lived in the house less than two years?
You may still get a partial exclusion if you moved for work, health or an unforeseen event. Otherwise the full gain is taxable, and if you owned the home for one year or less it is taxed at ordinary income rates rather than the lower long-term capital gains rates.
More in Selling a Home
Selling a Home
Seller Disclosure and What You Must Tell a Buyer
You know the basement took on water in 2021, and you fixed it.
Selling a Home
Selling a House As Is and What Buyers Will Still Expect
The roof is 22 years old, the basement smells damp after rain, and you do not have $30,000 or six spare weekends to fix any of...
Selling a Home
Low Appraisal When Selling a House and What to Do Next
You accepted an offer at $420,000, packed half the kitchen, and then the buyer's lender called with bad news: the appraisal...