Capital Gains on a Home Sale: How It Works and How to Pay Less
Andreas G.July 25, 20269 min read
When you sell your home for more than you paid, the profit is a capital gain, and it can be taxed. The good news for most homeowners: a long-standing tax break means a large share of that gain, and often all of it, is never taxed at all. The part that can be taxed comes down to a number you have more control over than you might think: your adjusted cost basis.
Here is how capital gains on a home sale actually work, the exclusion that covers most people, and the one habit that can quietly save you thousands. (One note before we start: this is general information, not tax advice. Rules change and every situation is different, so check with a tax professional about yours.)
What "capital gains on a home sale" means
Your capital gain is not simply your sale price. It is what is left after two subtractions:
Sale price − selling costs − adjusted cost basis = your gain.
- Selling costs are the expenses of the sale itself: the real estate commission, legal and title fees, transfer taxes, and similar closing costs.
- Adjusted cost basis is what the home has cost you over time: the original purchase price, plus the closing costs you paid to buy it, plus the capital improvements you have made, minus certain items like depreciation or insurance reimbursements.
So two homes that both "sold for $700,000" can produce very different tax bills, depending on what each owner can prove they put in.
The break that covers most sellers: the Section 121 exclusion
Here is the part that surprises people, in a good way. Under Section 121 of the tax code, if the home was your main home, you can exclude a big chunk of the gain from tax:
- Up to $250,000 of gain if you file as single, or
- Up to $500,000 if you are married filing jointly.
To qualify, you generally need to pass the ownership and use test: you owned the home and lived in it as your main home for at least two of the five years before the sale. Those two years (24 months) do not have to be consecutive, and you generally can only use the full exclusion once every two years. The details and the partial-exclusion exceptions are laid out in IRS Publication 523, Selling Your Home.
For a lot of homeowners, that is the whole story: gain under the limit, tax owed of zero. Where it gets interesting is when the gain runs past the exclusion, because then every dollar of basis you can document comes straight off the taxable amount.
How to calculate your gain (a worked example)
Say a married couple bought a home for $300,000, and over the years put in $80,000 of documented improvements: a new roof, a kitchen remodel, and an HVAC replacement. They sell for $700,000 and pay $42,000 in selling costs (a 6% commission plus fees).
- Amount realized: $700,000 − $42,000 = $658,000
- Adjusted cost basis: $300,000 + $80,000 = $380,000
- Gain: $658,000 − $380,000 = $278,000
Because they are married and pass the two-year test, they exclude up to $500,000. Their $278,000 gain is fully covered, so they owe $0 in capital gains tax.
Now run the same numbers for a single filer, whose exclusion is $250,000. Their taxable gain is $278,000 − $250,000 = $28,000, taxed at the long-term capital gains rate (more on rates below).
What the tax rate would be
If you owned the home for more than a year, any taxable gain is a long-term capital gain, taxed at 0%, 15%, or 20% depending on your total taxable income for the year (see IRS Topic No. 409). Higher earners may also owe an extra 3.8% net investment income tax on part of the gain. The brackets adjust each year, so the exact cutoffs are worth checking for the year you sell.
In the single-filer example above, $28,000 taxed at 15% would be about $4,200.
How to pay less: raise your basis, and keep the proof
This is where the earlier point pays off. Every dollar of legitimate cost basis reduces your taxable gain by a dollar. Two levers matter most.
1. Count your capital improvements. Improvements that add value, extend the home's life, or adapt it to a new use get added to your basis. A new roof, a remodeled kitchen or bath, an addition, new HVAC, replacement windows, a deck. Routine repairs and maintenance (repainting the same color, fixing a leak, servicing the furnace) generally do not count. We break down exactly what to save and what to skip, and the mechanics of adjusting your basis in more depth.
2. Include your selling and buying costs. Commissions, legal fees, and certain closing costs on both ends reduce the taxable gain.
Now the part that actually decides whether any of this helps you: you have to be able to prove it. The IRS can ask for records that show the work was done and what it cost. Go back to the example. If that single filer had made the same $80,000 of improvements but could not document them, their basis would be $300,000, not $380,000. Their taxable gain would jump to $108,000, and the tax at 15% to roughly $16,200. Documenting that $80,000 can be the difference of about $12,000.
That is the case for keeping records the whole time you own, not scrambling for them at closing. When a repair invoice or improvement receipt arrives by email, forwarding it to HouseFacts files it with your home and adds it to your cost and improvement history, so the proof is already there when it is time to sell. Records like these pay off in plenty of ordinary years too, through warranty claims, insurance, and better repair decisions. The tax break at sale is the bonus at the end.
A few myths worth clearing up
The questions people ask about home-sale taxes are full of outdated rules. A quick tour:
"Do I pay capital gains after age 65? Isn't there a senior or one-time exemption?" No. The old over-55, one-time exclusion was replaced back in 1997 by the current Section 121 rules. There is no special break for being over 65. Everyone uses the same $250,000/$500,000 exclusion and the same two-year test.
"Can I avoid the tax by buying another home?" Not for your main home. The old rollover rule that let you defer gain by buying a more expensive house was also repealed in 1997. (You may be thinking of a 1031 exchange, which applies to investment and business property, not the home you live in.)
"What about the 6-year rule?" That is a rule from another country's tax system, not a U.S. one. In the U.S., what matters for your main home is the two-of-five-year ownership and use test, plus the partial-exclusion exceptions for moves tied to work, health, or other unforeseen events.
"What if I inherited the home?" Different, and often better. Inherited property usually gets a stepped-up basis to its value on the date of death, which can erase most or all of the gain. We cover step-up basis and the records heirs need separately.
Second homes, rentals, and state taxes
- Second homes and rentals do not get the Section 121 exclusion (it is only for your main home), so more of the gain can be taxable. Rentals also involve depreciation recapture, which is its own calculation.
- State taxes can apply on top of federal. A few states (Florida and Texas among them) have no state income tax, so there is no state capital gains tax on the sale. Most states do tax the gain, so factor your state in.
What to keep, from day one
If you take one thing from all of this: the tax break at sale is decided by records you gather years earlier. Keep, for the whole time you own the home:
- Receipts and invoices for every improvement, with proof of payment
- Permits and contracts for larger projects
- Your closing documents from the purchase and, later, the sale
- Before-and-after photos for bigger jobs
Whether that lives in a labeled folder or a home record that fills itself as receipts come in, the goal is the same: when you sell, the number that lowers your tax is already documented.
The short version
For most homeowners, the $250,000/$500,000 exclusion means a home sale is tax-free. When the gain is larger, your taxable amount is set by your adjusted basis, and the improvements you can prove are what bring it down. Track them as you go, keep the receipts, and you can walk into the sale with the lowest legitimate tax bill already lined up.
This article is general information, not tax advice. Consult a qualified tax professional about your specific situation.
Keep reading
organizationmaintenanceThe 10 Numbers Every Homeowner Should Have Saved Before a Crisis Hits
Don't wait for a burst pipe or a midnight lockout to realize you're unprepared. Here are the 10 essential contacts every homeowner needs saved before an emergency strikes, plus a free printable template.
organizationmaintenanceThe Room-by-Room Spring Cleaning Checklist for Homeowners: Protect Your Home's Value
Spring cleaning goes beyond tidying up. Use this room-by-room home maintenance checklist to protect your home's value and catch costly repairs before they happen.
organizationhousefactsBeyond Checklists: How Premium Property Management Tools Let Your Second Home Thrive, Even When You’re Not There
Second homes come with double the maintenance and double the paperwork. Here’s how the right property management tools keep yours protected while you’re away.