How to lower your capital gains tax bill on a home sale
The main way to reduce capital gains tax on a home sale is to use the primary residence exclusion, which lets you exclude up to $250,000 of gain if you're single, or $500,000 if you're married filing jointly. You must have owned and lived in the home as your main residence for at least two of the five years before you sell. Beyond that, the strategies available depend on your situation: when you bought, how much the home appreciated, whether you've used the exclusion before, and what improvements you've made.
This guide covers the real levers you can pull — some before you sell, some during the sale itself, and some in how you report it. None of these are loopholes; they're built into tax law. But they do require you to understand what counts, what doesn't, and what you need to document.
Key Takeaways
- The primary residence exclusion eliminates tax on the first $250,000 (single) or $500,000 (married) of home sale gain if you lived there two of the last five years.
- Capital improvements — new roof, kitchen remodel, deck addition — add to your cost basis and reduce your taxable gain dollar-for-dollar, but repairs and maintenance do not.
- If you've used the exclusion in the past two years, you cannot use it again; if you used it more than two years ago, you can use it once more.
- Timing your sale around the two-year ownership requirement, or delaying a sale if you've recently used the exclusion, can mean the difference between owing tax and owing nothing.
- Keeping receipts and invoices for all home improvements is essential — the IRS will ask for documentation if your gain seems high relative to the sale price.
Understand your cost basis and what raises it
Your cost basis is what you paid for the home plus the cost of permanent improvements. The higher your basis, the lower your taxable gain. When you sell, your gain is the sale price minus your basis (minus selling costs like realtor commissions).
Capital improvements — work that adds value, prolongs the home's life, or adapts it to a new use — increase your basis. A new roof, kitchen renovation, bathroom remodel, deck, fence, HVAC system, or foundation repair all count. Painting the exterior counts. Adding insulation counts. A new driveway counts.
Repairs and maintenance do not. Fixing a leaky faucet, patching drywall, repainting interior walls, or replacing a broken window do not raise your basis. The IRS distinguishes between work that keeps the home in good condition (repairs) and work that improves it beyond its original condition (improvements). When in doubt, keep the invoice anyway — if you're audited, you can explain it to the IRS agent.
If you inherited the home or received it as a gift, your basis may be different. Inherited homes get a stepped-up basis, meaning your basis is the home's fair market value on the date of the owner's death, not what they paid. This can dramatically reduce your gain. Gifted homes keep the donor's original basis. Consult a tax professional if either applies to you.
Verify you meet the two-year ownership and use test
To use the primary residence exclusion, you must have owned the home and lived in it as your main residence for at least two of the five years before the sale. The two years do not have to be consecutive, and they do not have to be the most recent two years.
If you owned the home for five years but lived there for only one year before selling, you do not meet the test. If you owned it for two years, moved out, rented it for two years, then sold it, you still meet the test because you lived there two of the five years. If you sold it, then bought it back within two years, the IRS may disallow the exclusion on the second sale — this is a common trap for people who sell and regret it.
If you've used the exclusion within the past two years, you cannot use it again on another home sale. If you used it more than two years ago, you can use it once more. This matters if you're selling a second home or if you sold a previous home recently and are now selling another.
Document all improvements with receipts and invoices
The IRS does not take your word for the cost of improvements. You need receipts, invoices, canceled checks, or credit card statements showing what you paid and what was done. If you cannot document an improvement, the IRS will disallow it.
Keep these records in one place — a folder, a spreadsheet, or a file on your computer. Include the date, the contractor or vendor name, the description of the work, and the amount paid. If you did the work yourself, you can deduct the cost of materials but not your labor. A $5,000 kitchen renovation where you hired a contractor is deductible; a $5,000 kitchen renovation where you did the work yourself is deductible only for the $2,000 in materials you bought.
When you sell, your tax preparer or CPA will ask for this documentation. They will add up the improvements, subtract them from your sale price, and calculate your gain. If your gain is unusually high relative to the sale price, the IRS may request documentation during an audit. Having it ready makes the process fast.
Consider the timing of your sale relative to the two-year rule
If you're close to the two-year ownership mark, waiting a few months to cross it can save you thousands in tax. If you've owned the home for 22 months and are thinking of selling, waiting two more months lets you use the exclusion. If you've owned it for five years but lived there for only 18 months, waiting four more months lets you use the exclusion.
Conversely, if you've used the exclusion recently and are thinking of selling another home, delaying the sale until two years have passed since the last sale lets you use the exclusion again. This is less common but matters if you're a real estate investor or if you've moved multiple times in a short period.
This timing strategy works only if you have control over when you sell. If you're selling because of a job move, a divorce, or a financial emergency, you may not have the luxury of waiting. But if you're selling because the market is good or because you want to downsize, timing can be worth thousands.
Separate your home sale from investment property or rental income
If you've rented out part of your home — a basement apartment, a guest house, or even a room — the IRS may disallow the exclusion for that portion. The exclusion applies to your primary residence, not to rental property. If you rented out 20% of the home, you may owe tax on 20% of the gain.
If you converted a rental property to your primary residence, you can use the exclusion only for the years you lived there, not the years you rented it out. If you owned a rental for five years, then moved in and lived there for two years, then sold it, you can exclude gain only on the two years you lived there. The five years of rental ownership do not count.
This rule also applies if you used part of your home as a home office. If you deducted home office expenses on your tax return, the IRS may treat that portion as business property and disallow the exclusion for it. If you used a room as a home office, keep records of how much of the home it represented (square footage) so you can calculate the portion of gain subject to tax.
Understand how state taxes and local taxes affect your bill
Federal capital gains tax is only part of your bill. Some states tax capital gains on home sales; others do not. California, New York, Oregon, and several others tax long-term capital gains as ordinary income. A few states, like Washington and Tennessee, tax capital gains but exempt home sales. Most states do not tax capital gains at all.
If you're selling a home in a state that taxes capital gains, your state tax bill can be as large as your federal bill. The primary residence exclusion applies only to federal tax, not to state tax. Some states offer their own exclusions or reduced rates for primary residence sales, but they vary widely. If you're moving from one state to another or selling a home in a state with high capital gains tax, consult a tax professional in that state to understand your full bill.
Local taxes are rare but do exist in some cities. A few municipalities tax real estate sales or transfer the property. These are usually small — a few hundred dollars — but they add up. Your realtor or title company can tell you whether your city or county has a transfer tax.
Frequently Asked Questions
Can I use the primary residence exclusion if I'm selling a vacation home or investment property?
No. The exclusion applies only to your primary residence — the home where you live most of the time. A vacation home, rental property, or investment property does not may have access to, even if you lived there for two years at some point. If you converted a vacation home to your primary residence and lived there for two of the last five years, you can use the exclusion, but only for the gain that accrued after you moved in.
What if I'm divorced and selling a home I owned with my ex-spouse?
Each spouse can use the exclusion separately if they meet the two-year test. If you and your ex both lived in the home for two of the last five years, you can each exclude $250,000 of gain, for a combined $500,000 exclusion. If only one of you lived there, only that person can use the exclusion. The divorce decree or settlement agreement should specify who gets the exclusion; consult a tax professional to make sure it's structured correctly.
Do I have to report the sale to the IRS even if my gain is under the exclusion amount?
You must report the sale on Form 8949 and Schedule D if you have any gain at all, even if the gain is fully excluded. The IRS wants to see the calculation — the sale price, your basis, and the exclusion applied. If you have no gain (you sold for less than you paid), you do not have to report it, but you can if you want to document a loss for other purposes.
Can I deduct the cost of selling the home, like realtor commissions, from my gain?
Yes. Selling costs — realtor commissions, title insurance, attorney fees, and transfer taxes — reduce your gain. If you sold for $400,000 and paid $24,000 in realtor commissions and closing costs, your net proceeds are $376,000. Your gain is the net proceeds minus your basis, not the gross sale price. Make sure your tax preparer includes these costs in the calculation.
What if I made major improvements but don't have receipts anymore?
Without receipts, the IRS will not allow the deduction. If you paid by credit card or check, you may be able to reconstruct the receipt from your bank or credit card statement, which shows the vendor name and amount. If you paid cash and have no documentation, you cannot deduct it. Going forward, keep all receipts and invoices in a safe place — a filing cabinet, a safe deposit box, or a scanned folder on your computer.