You cannot avoid capital gains tax entirely, but you can reduce what you owe through specific strategies that the IRS allows

Capital gains tax is the federal tax on profit when you sell property for more than you paid for it. The IRS does not allow you to skip this tax, but several legal methods let you lower the amount you owe or push the tax to a later year. The most common are the primary residence exclusion, holding property longer to may have access to for lower tax rates, and using losses from other investments to offset gains. Which strategy works depends on how long you owned the property, whether it was your home, and your total income that year.

State and local taxes on property sales vary widely. Some states have no capital gains tax at all; others tax it like regular income. Check your state's department of revenue website to learn what applies where you live, because federal strategies do not reduce state taxes.

Key Takeaways

  • If you owned and lived in the home for at least two of the last five years before selling, you can exclude up to $250,000 in gains from federal tax (or $500,000 if married filing jointly).
  • Property held for more than one year qualifies for long-term capital gains rates, which are lower than short-term rates and depend on your total income.
  • You can use investment losses from the same year to offset gains dollar-for-dollar, or carry unused losses forward to future years.
  • Installment sales, charitable donations of appreciated property, and 1031 exchanges are advanced strategies that defer or eliminate tax in specific situations.
  • State and local capital gains taxes are separate from federal tax and are not reduced by these federal strategies.

The primary residence exclusion: up to $250,000 or $500,000 tax-free

If you owned and lived in the home as your main residence for at least two of the five years before you sold it, you can exclude a portion of the gain from federal tax. Single filers exclude up to $250,000; married couples filing jointly exclude up to $500,000. This is the single largest tax break available for residential property sales.

The two-year ownership and use requirement does not have to be consecutive. You can own the home for three years, move out for one year, then sell — and still may have access to. However, you can only use this exclusion once every two years. If you sold a home and used the exclusion in 2022, you cannot use it again until 2024.

Rental properties, investment homes, and vacation homes do not may have access to for this exclusion. The home must have been your primary residence — the place where you lived most of the time. If you rented out part of the home (like a basement apartment) but lived in the rest, you may still may have access to, but the gain attributable to the rental portion is taxable.

Long-term versus short-term capital gains rates

How long you held the property determines which tax rate applies. Long-term capital gains are taxed at 0%, 15%, or 20% depending on your income bracket. Short-term capital gains are taxed as ordinary income, which can be as high as 37%. The difference is substantial.

You may have access to for long-term rates if you owned the property for more than one year before selling. If you sell within one year of purchase, short-term rates apply. For example, if you bought a rental property in March 2023 and sold it in April 2024, you own it for just over one year and may have access to for long-term rates. If you sold it in March 2024, you do not.

Long-term rates depend on your total taxable income for the year. In 2024, the 0% rate applies to single filers with income under roughly $47,000 and married filers under roughly $94,000. The 15% rate applies to income above that threshold up to roughly $518,000 (single) or $583,000 (married). Income above that is taxed at 20%. These thresholds change each year. Check the IRS website or a tax professional for the current year's brackets.

Using investment losses to offset gains

If you have losses from selling other investments — stocks, bonds, or other property — you can use those losses to reduce your capital gains dollar-for-dollar in the same tax year. This is called loss harvesting. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against ordinary income. Any remaining loss carries forward to future years.

For example: you sell a rental property and realize a $50,000 gain. You also sold stocks at a $20,000 loss. You report the $50,000 gain and $20,000 loss, resulting in a net $30,000 gain subject to tax. If your losses totaled $60,000, you would offset the entire $50,000 gain, deduct $3,000 against other income, and carry the remaining $7,000 loss forward to next year.

This strategy requires you to have investment losses available. You cannot create losses artificially or use losses from personal property (like selling a car at a loss). The losses must come from investments or business property sold at a loss.

Installment sales: spreading the gain across multiple years

An installment sale is when you sell property but the buyer pays you over time rather than in a lump sum. Instead of reporting all the gain in the year of sale, you report it proportionally as you receive payments. This can lower your taxable income in the year of sale and spread the tax burden across multiple years.

For example: you sell a rental property for $500,000. You paid $300,000 for it, so the gain is $200,000. The buyer pays you $100,000 at closing and $100,000 per year for the next four years. You report 40% of each payment as gain ($40,000 per year for five years) rather than the full $200,000 in year one. This may keep you in a lower tax bracket each year.

Installment sales are complex and have strict IRS rules. You must report them on Form 6252, and the buyer must sign a promissory note. If the property is mortgaged, the sale may not may have access to. Consult a tax professional before structuring a sale this way.

1031 exchanges: deferring tax by reinvesting in like-kind property

A 1031 exchange (named after the tax code section) lets you sell investment or business property and reinvest the proceeds in similar property without paying capital gains tax at the time of sale. The tax is deferred, not eliminated — you owe it when you eventually sell the replacement property without doing another exchange.

The rules are strict. You have 45 days from the sale to identify replacement property and 180 days to close on it. The replacement property must be of equal or greater value and must be "like-kind" — for real estate, this means any real property (land, buildings, rental homes) can be exchanged for any other real property. You cannot exchange real estate for personal property or cash.

You must use a may have access to intermediary — a third party who holds the sale proceeds and buys the replacement property on your behalf. You cannot touch the money yourself, or the exchange fails and you owe tax immediately. Intermediaries charge fees, typically $500 to $1,500.

Charitable donations of appreciated property

If you donate appreciated property (such as real estate) to a may have access to charity, you avoid capital gains tax on the appreciation and receive a charitable deduction for the property's fair market value. This works only if the charity is a may have access to organization under IRS rules — typically 501(c)(3) nonprofits.

For example: you own a vacant lot you bought for $100,000. It is now worth $300,000. If you sell it, you owe tax on the $200,000 gain. If you donate it to a land trust or nonprofit, you avoid the tax and can deduct $300,000 (subject to income limits on charitable deductions). The charity receives the property and can use or sell it.

This strategy works best if you have significant gains and want to support a cause. The deduction is limited to a percentage of your adjusted gross income (typically 30% to 50%, depending on the property type and organization). Excess deductions carry forward five years. You must obtain a may have access to appraisal and file Form 8283 with your tax return.

Timing the sale and managing your income in the year of sale

The year you sell property affects your tax rate. If you are near the edge of a tax bracket, delaying or accelerating the sale by a few months can move you into a lower bracket and reduce your long-term capital gains rate from 15% to 0%, or from 20% to 15%.

You can also manage other income in the year of sale. If you have control over when you receive bonuses, retirement distributions, or self-employment income, timing these to a different year can keep your total income lower in the year you sell property. This is most useful if you are close to a bracket threshold.

This strategy requires planning and is most effective if you have flexibility over when you sell or when you receive other income. A tax professional can model different scenarios for you.

Frequently Asked Questions

Do I have to pay capital gains tax if I sell my home?

Not necessarily. If you owned and lived in the home for at least two of the last five years, you can exclude up to $250,000 (or $500,000 if married filing jointly) from federal tax. Many home sales result in no federal tax at all because the gain falls within this exclusion.

What if I sell property at a loss?

If you sell investment or business property at a loss, you can use that loss to offset capital gains from other sales in the same year. If losses exceed gains, you can deduct up to $3,000 against ordinary income and carry the rest forward to future years. Losses on personal residences (other than the primary residence exclusion) cannot be deducted.

Can I avoid capital gains tax by holding the property longer?

Holding longer does not eliminate tax, but it qualifies you for long-term capital gains rates (0%, 15%, or 20%) instead of short-term rates (up to 37%). You must hold the property for more than one year. After that, holding longer does not reduce the rate further, though it may help if you are managing income across years.

What is the difference between federal and state capital gains tax?

Federal capital gains tax is what the IRS collects. State and local taxes are separate and vary by location. Some states have no capital gains tax; others tax it as ordinary income. Federal strategies like the primary residence exclusion do not reduce state taxes. Check your state's tax rules separately.

Should I use a 1031 exchange?

A 1031 exchange defers tax but does not eliminate it, and the rules are complex. It makes sense if you plan to reinvest in similar property and want to avoid tax now. If you eventually want to cash out, you will owe the deferred tax then. Consult a tax professional to determine if it fits your situation.