What actually reduces your capital gains tax bill on a home or investment property
Capital gains tax on real estate is calculated on the profit you make — the sale price minus what you paid for the property, minus certain costs. You cannot eliminate the tax on a profit, but you can reduce the taxable profit itself through deductions, timing choices, and specific strategies the tax code allows. The most common approach is the primary residence exclusion, which lets you exclude up to $250,000 (or $500,000 if married filing jointly) of profit if you owned and lived in the home for at least two of the five years before the sale.
Beyond that exclusion, the strategies that actually work involve either reducing your taxable profit through documented expenses, deferring the tax to a later year, or in limited cases, converting the property type before sale. None of these are loopholes — they are written into the tax code and require specific conditions and paperwork to claim.
Key Takeaways
- The primary residence exclusion ($250,000 single, $500,000 married) is the largest tax reduction available, but requires you to have owned and lived in the home for at least two of the five years before sale.
- Capital improvements made to the property — new roof, addition, major renovation — can be added to your cost basis and reduce taxable profit, but repairs and maintenance cannot.
- A 1031 exchange lets you defer capital gains tax by reinvesting the sale proceeds into another investment property of equal or greater value within strict timelines, but does not eliminate the tax permanently.
- Timing the sale across two tax years, harvesting losses on other investments, or gifting the property to heirs can reduce or defer tax, but each has specific requirements and trade-offs.
- Installment sales, charitable donations of property, and opportunity zone investments are less common but may reduce tax in particular situations.
Using the primary residence exclusion correctly
If you are selling a home you have lived in, you may be able to exclude $250,000 of profit from federal tax (or $500,000 if you are married filing jointly). This is the single largest tax break available on real estate. To claim it, you must have owned the property and used it as your main home for at least two of the five years before the sale.
The two years do not have to be consecutive, and you do not have to live there at the time of sale — only that you owned it and lived there for two of the previous five years. If you owned the home for longer, you still only get one exclusion per two years, so selling two homes in one year means you can only claim the exclusion on one of them.
If you inherited the home, the rules are different. You get a "stepped-up basis," meaning your cost basis is the property's value on the date of death, not what the original owner paid. This can eliminate or drastically reduce capital gains tax on inherited property, though state inheritance taxes may apply in some states.
Adding capital improvements to reduce your cost basis
Your taxable profit is the sale price minus your "adjusted cost basis" — what you paid for the property plus the cost of improvements. A new roof, an addition, a new HVAC system, or a major kitchen renovation can be added to your basis. Painting, routine repairs, lawn maintenance, and property management fees cannot.
The distinction matters: improvements add value to the property or extend its life; repairs maintain it at its current condition. If you replaced a broken window, that is a repair. If you replaced all the windows with energy-efficient ones as part of a renovation, that is an improvement. Keep receipts, invoices, and permits for any work you claim. The IRS may ask for documentation, especially on large improvements.
If you made $50,000 in improvements over the years you owned the property, your cost basis increases by $50,000, which reduces your taxable profit by $50,000. On a 15% or 20% federal capital gains rate, that saves you $7,500 to $10,000 in federal tax alone.
Deferring tax through a 1031 exchange
A 1031 exchange (named after the tax code section) lets you sell an investment property and reinvest the proceeds into another investment property without paying capital gains tax on the sale — but only if you follow strict rules. The tax is deferred, not eliminated; you will owe it when you eventually sell the second property, unless you do another 1031 exchange at that time.
The rules are tight. You have 45 days from the sale to identify the replacement property and 180 days to close on it. The replacement property must be of equal or greater value; if you sell for $500,000, you must reinvest at least $500,000. The property must be "like-kind," which for real estate means any real property used in a business or held for investment — a rental house, apartment building, commercial space, or land all may have access to, but your primary residence does not.
You cannot touch the sale proceeds yourself; they must go to a may have access to intermediary (a third party who holds the money and coordinates the exchange). If you receive any cash or take a loan against the proceeds, you owe tax on that amount. Many investors use 1031 exchanges to move from one rental property to another without triggering a tax bill, then repeat the process years later.
Timing the sale and harvesting losses on other investments
If you have a large capital gain on the property, you can offset it with capital losses from other investments — stocks, mutual funds, or other property sales. If you sold stocks at a loss earlier in the year, or you own investments that have declined in value, selling those losses in the same tax year reduces your net capital gain.
You can also split the sale across two tax years if the closing happens late in the year. If you close on December 28, the gain is recognized in that tax year. If you close on January 5, it is recognized in the new year. This does not reduce the total tax, but it can spread the tax bill across two years and may keep you in a lower tax bracket in one of those years.
If you have significant losses that exceed your gains in a year, you can carry the excess loss forward to future years, up to $3,000 per year against ordinary income, with unlimited carryforward of unused losses.
Gifting property to heirs and stepped-up basis
If you gift a property to someone during your lifetime, they inherit your cost basis, meaning they owe capital gains tax on the same profit you would have owed. This does not save tax.
If you hold the property until death and it passes to your heirs through your estate, they receive a "stepped-up basis" — their cost basis becomes the property's fair market value on the date of your death. If you bought the home for $200,000 and it is worth $500,000 when you die, your heirs' basis is $500,000. If they sell it immediately, they owe no capital gains tax. This is one of the largest tax benefits in the code, but it only applies to property held until death, not gifted during life.
Less common strategies: installment sales, charitable donations, and opportunity zones
An installment sale spreads the sale price over multiple years, which can spread your capital gains across multiple tax years and potentially keep you in a lower bracket each year. You sell the property and the buyer pays you over time; you report the gain as payments arrive. This requires a private buyer willing to finance the purchase and carries risk if the buyer defaults.
If you donate a property to a may have access to charity, you can deduct the fair market value of the property and avoid capital gains tax on the appreciation. This works best if the property has appreciated significantly and you have no other use for it. You must donate to a may have access to organization (most nonprofits, educational institutions, and religious organizations may have access to) and obtain a may have access to appraisal.
Opportunity zone investments are a federal program that offers tax deferral and potential tax elimination on capital gains reinvested in economically distressed areas. If you sell a property and reinvest the proceeds in an opportunity zone fund within 180 days, you defer the capital gains tax. If you hold the investment for at least ten years, the gains on the new investment are tax-free. This is complex and requires working with a fund manager and tax professional.
Frequently Asked Questions
Can I avoid capital gains tax by renting out my home after I sell it?
No. The tax is owed when you sell, based on the sale price at that moment. Renting the property before or after sale does not change the tax on the sale itself. However, if you convert your primary residence to a rental before selling, you may lose part of the primary residence exclusion for the years it was rented.
What if I sell at a loss — do I get a tax deduction?
Not on a primary residence. If you sell your home for less than you paid, you cannot deduct the loss. On investment property, you can claim the loss against other capital gains in that year, and carry excess losses forward to future years.
Do state capital gains taxes apply to real estate sales?
Most states do not have a separate capital gains tax, but some do — California, New York, and a few others tax capital gains at ordinary income rates. A few states (Washington, Illinois) have recently enacted capital gains taxes. Check your state's tax rules; state tax can be as significant as federal tax.
Can I claim the primary residence exclusion on a second home or vacation property?
No. The exclusion applies only to your main home — the place you lived most of the time. A vacation home, investment property, or home you rented out does not may have access to, even if you owned it for many years.
If I do a 1031 exchange, do I ever have to pay the capital gains tax?
Yes, eventually. The tax is deferred, not forgiven. When you sell the second property, you owe tax on the gain from both the first and second property, unless you do another 1031 exchange. Some investors chain exchanges together for decades, deferring tax indefinitely, but the tax remains owed if the property is ever sold outside an exchange or passed to heirs.