You cannot avoid capital gains tax entirely, but you can reduce it through specific strategies that the tax code allows

Capital gains tax is what you owe on the profit when you sell real estate for more than you paid for it. The tax code offers several legal ways to shrink that profit on paper — or push the tax bill to a later year — but none of them eliminate the tax completely. The most common route is the primary residence exclusion, which lets you exclude up to $250,000 of profit if you are single, or $500,000 if you are married filing jointly, as long as you meet ownership and use tests. Other strategies include 1031 exchanges (which defer tax by rolling the proceeds into another property), installment sales (which spread the gain across multiple years), and cost basis step-up (which applies only after death). Which one works depends on what you own, how long you have owned it, and whether you are selling now or planning ahead.

Key Takeaways

  • The primary residence exclusion wipes out up to $250,000 of profit (or $500,000 if married) if you lived in the home as your main residence for at least two of the last five years before selling.
  • A 1031 exchange defers all capital gains tax by reinvesting the sale proceeds into another investment property of equal or greater value within strict timelines.
  • Installment sales let you spread the taxable gain across multiple years by accepting payments from the buyer over time, which can lower your tax bracket each year.
  • Cost basis step-up applies only after death and resets the property value to its market price on the date of death, erasing gains for heirs.
  • Holding periods, property type, and your income level all affect which strategies are available to you and how much tax you actually owe.

Primary Residence Exclusion: The most common tax break

If you sell a home you have lived in, you can exclude $250,000 of profit from federal income tax (or $500,000 if you are married and file jointly). This is not a deferral — the gain simply does not count as taxable income. To use it, you must have owned the home and lived in it as your primary residence for at least two of the five years before the sale. The two years do not have to be consecutive.

Example: You bought a house for $300,000, lived in it for three years, then rented it out for two years before selling it for $600,000. Your profit is $300,000. Because you lived there for three of the last five years, you can exclude $250,000 (single) or $500,000 (married filing jointly). If you are single, you owe tax on $50,000 of gain. If you are married filing jointly, you owe tax on zero.

You can use this exclusion only once every two years. If you are married and file separately, each spouse can exclude only $250,000. State income tax still applies — this exclusion covers federal tax only.

1031 Exchange: Deferring tax by buying another investment property

A 1031 exchange (named after Section 1031 of the Internal Revenue Code) lets you sell one investment property and buy another without paying capital gains tax on the sale, as long as you follow strict rules. The tax is not erased — it is deferred until you eventually sell the replacement property for cash. Many investors use a series of 1031 exchanges to keep deferring tax indefinitely.

The rules are rigid. You have 45 days from the sale to identify the replacement property in writing, and 180 days to close on it. The replacement property must be of equal or greater value. Both properties must be held for investment or business use — your primary home does not may have access to. You cannot do a 1031 exchange with a vacation home or a property you rent short-term through a platform like Airbnb (though the IRS rules on short-term rentals are still evolving). You must use a may have access to intermediary — a neutral third party who holds the sale proceeds and transfers them to the seller of the replacement property. You cannot touch the money yourself, or the exchange fails and you owe tax immediately.

A 1031 exchange is complex and requires a real estate attorney or tax professional to set up correctly. Mistakes are common and costly.

Installment Sales: Spreading the gain across multiple years

An installment sale is when you sell the property but the buyer pays you over time — typically in annual or monthly installments — rather than all at closing. You report the taxable gain in proportion to the payments you receive each year. This spreads your income across multiple tax years, which can keep you in a lower tax bracket and reduce the total tax you owe.

Example: You sell a rental property for $500,000 with a $100,000 profit. Instead of receiving all $500,000 at closing, the buyer signs a promissory note and pays you $100,000 per year for five years. You report $20,000 of the gain each year (one-fifth of the total). If your other income is lower in those years, you may pay less tax overall than if you had received the full amount in year one.

Installment sales work best when you are willing to act as the lender and accept the risk that the buyer might default. You also need to report interest income on the unpaid balance. The IRS requires you to charge a minimum interest rate (the Applicable Federal Rate, or AFR), which changes monthly. A tax professional should structure the note to ensure you comply with tax rules.

Cost Basis Step-Up: A strategy that only works after death

When someone dies and leaves real estate to an heir, the property's cost basis (the value used to calculate future gains) is "stepped up" to its market value on the date of death. This means if the deceased person bought a house for $200,000 and it was worth $500,000 when they died, the heir's cost basis becomes $500,000. If the heir sells it shortly after for $500,000, there is no taxable gain.

This is not a strategy you can use yourself — it applies only to heirs. But it is relevant if you are planning your estate or wondering why someone who inherited property might not owe capital gains tax. The step-up applies to all real estate, not just primary residences. It also applies to other assets like stocks and bonds.

The step-up rule has been debated in Congress and could change. It currently applies to all estates, regardless of size, though some proposals would limit it to smaller estates.

Holding Periods and Tax Rates: How long you own the property matters

Capital gains tax rates depend on how long you owned the property. If you sell within one year of buying, the gain is short-term capital gain, taxed as ordinary income at your regular tax bracket (up to 37% federally). If you hold for more than one year, it is long-term capital gain, taxed at lower rates: 0%, 15%, or 20% depending on your income level.

For investment properties, holding longer almost always means paying less tax. A rental property you have owned for five years will have a lower tax rate on the gain than one you owned for six months. This is one reason investors hold properties for years before selling.

State income tax rates vary widely. Some states have no income tax (Florida, Texas, Wyoming, and others). Some tax capital gains at the same rate as ordinary income. A few have separate capital gains taxes. Your state matters as much as the federal rate.

Losses, Depreciation Recapture, and Other Complications

If you sell a property for less than you paid for it, you have a capital loss. You can use losses to offset other capital gains. If losses exceed gains, you can deduct up to $3,000 of net loss against ordinary income in a single year, and carry forward unused losses to future years. This is one reason some investors sell losing properties strategically.

If you rented out the property, you have been deducting depreciation on your tax returns each year. When you sell, the IRS requires you to "recapture" that depreciation and pay tax on it at a 25% rate, separate from capital gains tax. This is not avoidable — it applies even if you use a 1031 exchange. Depreciation recapture can be a surprise to investors who did not plan for it.

If you converted a primary residence to a rental property, you can use the primary residence exclusion only on the years you lived there, not the years you rented it out. The calculation becomes more complex and usually requires a tax professional.

Frequently Asked Questions

Can I use the primary residence exclusion if I rent out part of my home?

Yes, as long as you live in the home as your primary residence. The exclusion applies to the whole property. However, if you deducted home office or rental expenses for that part, you may owe depreciation recapture tax on that portion of the gain. A tax professional should review your situation before you sell.

What happens if I do a 1031 exchange and the replacement property is worth less?

You owe capital gains tax on the difference. If you sell for $500,000 and buy a replacement for $400,000, you have $100,000 in "boot" (cash left over), and you owe tax on that $100,000 of gain. The replacement property must be equal or greater value to defer all the tax.

Do I have to report the sale to the IRS even if I think I owe no tax?

Yes. You report the sale on Form 8949 and Schedule D, even if the primary residence exclusion wipes out the gain. The IRS wants to see the transaction. Failing to report it can trigger an audit.

Can I use more than one strategy at the same time?

Some combinations work. For example, you could use the primary residence exclusion on a home sale and a 1031 exchange on a rental property sale in the same year. You cannot use the primary residence exclusion and a 1031 exchange on the same property. A tax professional can advise on what applies to your situation.

What if I inherited the property and then sell it — do I still owe capital gains tax?

You owe tax only on gains after you inherited it. The step-up resets the cost basis to the value on the date of death, so gains before that date are erased. If you inherited a house worth $500,000 and sold it two years later for $550,000, you owe tax on $50,000 of gain, not the full $550,000.