You cannot avoid capital gains tax entirely, but you can reduce it or delay paying it

When you sell real estate for more than you paid for it, the profit is taxable income. The IRS calls this a capital gain. You owe federal tax on it, and most states do too. However, there are several legal strategies that can lower the tax you owe or push the tax bill to a later year. The most common is the primary residence exclusion, which lets you exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly — but only if you meet specific ownership and use requirements.

Other strategies include timing the sale to spread gains across two tax years, using a 1031 exchange to swap one investment property for another without triggering tax when ready, or donating the property to charity. Which strategy makes sense depends on your situation: whether the property is your home or an investment, how long you have owned it, your income level, and your state's tax rules.

Key Takeaways

  • The primary residence exclusion lets you exclude $250,000 (single) or $500,000 (married) of gain from tax if you lived in the home for at least two of the past five years before selling.
  • A 1031 exchange defers capital gains tax by letting you reinvest the sale proceeds into another investment property, though the property must meet IRS rules and you must close within strict timelines.
  • Holding an investment property for more than one year qualifies the gain for long-term capital gains rates, which are lower than short-term rates and ordinary income tax rates.
  • Donating appreciated real estate to a may have access to charity lets you avoid capital gains tax on the donation and claim a charitable deduction for the property's full fair market value.
  • Installment sales, where the buyer pays you over time, can spread the gain across multiple tax years and lower your tax bracket in each year.

The primary residence exclusion for your home

If you are selling a house you live in, you may be able to exclude $250,000 of the gain from federal tax if you are single, or $500,000 if you are married filing jointly. This is the primary residence exclusion, and it is the most common way homeowners reduce capital gains tax.

To use it, you must have owned the home and lived in it as your main residence for at least two of the five years before you sell. The two years do not have to be consecutive, and they do not have to be the most recent two years. If you meet this test, the exclusion is automatic — you do not have to do anything special when you file your tax return, though you do report the sale on Form 8949.

If you are married and both spouses meet the ownership and use test, you can exclude up to $500,000 together. If only one spouse meets the test, that spouse can exclude $250,000. If you sell the home before meeting the two-year requirement — for example, because of a job transfer or health issue — you may still be able to claim a reduced exclusion. Talk to a tax professional about your specific situation, because the rules for reduced exclusions are detailed.

1031 exchanges for investment properties

A 1031 exchange is a way to sell one investment property and buy another without paying capital gains tax on the sale. Instead of receiving the cash from the sale, you use it to purchase a replacement property. The tax is deferred, not erased — you will owe it when you eventually sell the replacement property without doing another exchange.

The rules are strict. You must identify the replacement property within 45 days of closing on the sale, and you must close on the replacement property within 180 days of the original sale. You cannot touch the cash from the sale yourself — a may have access to intermediary (a third party approved by the IRS) must hold it and transfer it to the seller of the replacement property. The replacement property must be of equal or greater value than the property you sold, and it must be real estate held for investment or business use. Your primary residence does not may have access to.

Many investors use 1031 exchanges to trade up to larger properties or to move investments to different markets. Because the timelines are tight and the rules are complex, most people work with a 1031 exchange company or a tax professional to handle the transaction.

Long-term versus short-term capital gains rates

How long you own the property affects the tax rate you pay on the gain. If you sell after owning it for more than one year, the gain is taxed as a long-term capital gain. If you sell within one year, it is a short-term capital gain and is taxed as ordinary income at your regular tax bracket rate.

Long-term capital gains rates are lower than ordinary income rates for most people. For 2024, the federal long-term rate is 0%, 15%, or 20% depending on your total income, while ordinary income rates go up to 37%. This is one reason many real estate investors hold properties for at least a year before selling — the tax savings can be substantial.

If you are close to the one-year mark, delaying the sale by a few weeks or months can move you into the long-term category and lower your tax bill. This strategy works only if you can afford to wait and if market conditions do not change dramatically.

Installment sales that spread gains across years

An installment sale is when you sell the property but the buyer pays you over time instead of all at once. You report the gain proportionally as you receive each payment, which can spread your taxable income across multiple years and keep you in a lower tax bracket each year.

For example, if you sell a property for $500,000 with a $100,000 gain and the buyer pays you $100,000 per year for five years, you report $20,000 of gain each year instead of $100,000 in year one. This can lower your tax bill if the gain would otherwise push you into a higher bracket or trigger other tax consequences like the net investment income tax.

Installment sales require a promissory note and mortgage or deed of trust. You are essentially acting as the lender. There is risk — if the buyer defaults, you have to enforce the note — so this strategy works best when you trust the buyer or when the buyer has strong credit. A real estate attorney or tax professional can help you structure the sale correctly.

Charitable donations of appreciated property

If you donate appreciated real estate to a may have access to charity, you avoid capital gains tax on the appreciation and you can deduct the full fair market value of the property as a charitable contribution on your tax return. This works only if the charity is a may have access to organization under IRS rules — typically a nonprofit, religious organization, or public charity.

For example, if you bought land for $100,000 and it is now worth $300,000, donating it to a land trust or nonprofit means you owe no capital gains tax on the $200,000 gain. You can deduct $300,000 as a charitable contribution, subject to the limits on charitable deductions in your tax bracket. This strategy makes sense if you want to support a cause and if the tax deduction is worth more to you than selling the property and keeping the cash.

You will need a may have access to appraisal of the property and a written acknowledgment from the charity. The rules around charitable deductions are complex, especially for real estate, so work with a tax professional to make sure the donation qualifies and that you claim the deduction correctly.

Holding property in a trust or corporation

Some people hold real estate in a revocable living trust, a corporation, or an LLC to manage the property or for estate planning reasons. These structures do not reduce capital gains tax on the sale itself — you still owe tax on the gain. However, they can affect when the tax is due and how it is reported.

If you hold the property in a revocable living trust and you die before selling it, your heirs receive a step-up in basis. This means the property's tax basis is reset to its fair market value on the date of your death, not what you paid for it. If your heirs sell shortly after, there is little or no gain to tax. This is an estate planning benefit, not a way to avoid tax during your lifetime, but it can save your heirs a large tax bill.

Holding property in a corporation or LLC does not give you a step-up in basis and does not reduce capital gains tax. It may create other tax complications, so this structure should be chosen for liability protection or management reasons, not for tax savings on a sale.

State and local taxes on real estate sales

Most states tax capital gains on real estate, and some have rates higher than the federal rate. A few states — including Florida, Texas, and Wyoming — do not tax capital gains at all. If you are considering moving before selling a property, or if you own property in multiple states, the state tax difference can be significant.

Some states also impose transfer taxes or sales taxes on real estate transactions, which are separate from capital gains tax. These are usually paid by the seller and are not deductible against the gain. Check your state's rules, because the total tax bill on a sale can include federal capital gains tax, state capital gains tax, transfer tax, and local taxes all together.

Frequently Asked Questions

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

You can still use the exclusion if you rent out part of the home, but only for the portion you lived in. If you rented out a separate apartment or a large section, the IRS may treat that portion as investment property and tax the gain on it separately. The rules depend on how much of the home was rented and for how long. Consult a tax professional about your specific situation.

What happens to my capital gains tax if I sell at a loss?

If you sell for less than you paid, you have a capital loss. You cannot deduct a loss on the sale of your primary residence. On investment property, you can use the loss to offset other capital gains in the same year. If losses exceed gains, you can deduct up to $3,000 of the excess loss against ordinary income, and carry forward any remaining loss to future years.

Do I have to pay capital gains tax if I inherit real estate?

No, not on the inheritance itself. You receive a step-up in basis, meaning the property's tax basis becomes its fair market value on the date of the person's death. If you sell it shortly after inheriting it, there is usually little or no gain to tax. You only owe capital gains tax if you hold it and it appreciates further, then sell it later.

Can I do a 1031 exchange if I am selling my primary residence?

No. A 1031 exchange only works for investment or business property. Your primary residence does not may have access to. However, you can use the primary residence exclusion instead, which may eliminate or greatly reduce your tax bill.

What if I sell real estate in a different state than where I live?

You owe federal capital gains tax regardless of where the property is located. You also owe tax to the state where the property is located, not necessarily your home state. Some states have reciprocal agreements or credits to avoid double taxation, but you should check both states' rules. A tax professional familiar with multi-state real estate sales can help you understand your obligations.