Oberlin24

Taxes

How to Avoid Capital Gains Tax on Rental Property (and When You Only Defer It)

How to reduce or defer capital gains tax when you sell a rental: the 1031 exchange, the primary-residence exclusion, installment sales, and the suspended losses that offset your gain.

By Oberlin24· ·Updated July 1, 2026 ·9 min read

"How do I avoid capital gains tax on my rental property?" usually gets answered with a list of six strategies that never says which actually avoid the tax versus just push it down the road. Most of them defer. A couple genuinely erase it. And almost every list forgets the part that surprises landlords at closing: depreciation recapture, which is taxed separately and is not solved by holding the property longer.

So before the strategies, spend two minutes on what you are actually taxed on. It changes which moves are worth making.

What you are actually taxed on when you sell

Your gain is the sale price minus your adjusted basis (what you paid, plus improvements, minus all the depreciation you ever claimed). Every schedule on the property counts here, the building's 27.5 years and the faster 5- and 15-year assets alike. Notice that depreciation lowers your basis, so the deductions that saved you tax every year quietly raise your gain at sale. That gain is then taxed in layers:

  • Long-term capital gains (0/15/20%) on the appreciation, if you held over a year.
  • Depreciation recapture, the unrecaptured Section 1250 gain, at up to 25% on the depreciation you took.
  • Net investment income tax of 3.8% if your income is high.
  • State tax on top.

The recapture layer is the one people miss (Topic 409); we broke its math out separately in how depreciation recapture is calculated. A property that appreciated modestly can still owe a real bill purely from recapturing years of depreciation. So "avoiding capital gains tax" really means managing three different things, and the best strategies hit more than one.

A worked example: what the tax on a $450,000 sale actually looks like

Numbers make the layers concrete. Say you bought a rental for $300,000 ten years ago, claimed about $87,000 of depreciation along the way, and sell now for $450,000.

Line Amount
Sale price $450,000
Selling costs (~6%) ($30,000)
Amount realized $420,000
Adjusted basis (cost $300,000 − $87,000 depreciation) ($213,000)
Total gain $207,000

That gain is not taxed at one rate, it splits in two:

Gain layer Amount Rate Tax
Depreciation recapture (unrecaptured §1250) $87,000 up to 25% $21,750
Long-term capital gain (appreciation) $120,000 15% $18,000
Federal total $39,750

Then add the 3.8% NIIT if your income is high (about $7,866 here) and state tax on top. The number that surprises people is the $21,750: the property's market value only rose $120,000, yet more than a third of the federal bill is just recapturing depreciation you already benefited from. That is the layer holding longer does nothing to fix. And if you had, say, $30,000 of suspended passive losses parked on this property, they release at sale and come straight off that $207,000 gain, which is exactly why the next sections matter.

How to estimate the tax before you sell

You do not need a CPA to get a solid estimate of what a sale would cost, and running it before you list is what tells you which strategy below is actually worth the trouble. The math is three steps, and it is the same whether you call it a rental, an investment property, or just real estate you rent out:

  1. Find your adjusted basis. Original purchase price, plus capital improvements, minus all the depreciation you have claimed (or were allowed to claim). If you are unsure of the depreciation total, the rental depreciation calculator rebuilds it from your purchase price and date.
  2. Find your gain. Sale price, minus selling costs, minus that adjusted basis.
  3. Split the gain and tax each layer. Depreciation recapture (up to 25%) on the depreciation piece, long-term capital gains (0/15/20%) on the appreciation, then the 3.8% NIIT and state tax on top.

Rather than do this by hand, the 1031 exchange calculator runs the full waterfall, recapture, capital gains, state tax, and the suspended-loss release, and shows the sell-versus-defer number side by side. Get the estimate first, because it usually reframes the question from "how do I avoid the tax" into "which one of these levers actually moves my number."

Three different outcomes: defer, reduce, or truly avoid

  • Defer: 1031 exchange, installment sale, opportunity zones. The tax still exists, you just move it.
  • Reduce: the primary-residence exclusion, suspended-loss release, capital-loss harvesting. These shrink the taxable number.
  • Truly avoid: step-up in basis at death, and a charitable remainder trust. These are the only ones that make the tax disappear.

Now the strategies, in the order most landlords should consider them.

1031 exchange: defer the entire bill, recapture included

A 1031 exchange rolls your sale proceeds into a like-kind replacement property and defers the whole gain, capital gains and depreciation recapture both. You identify a replacement within 45 days and close within 180 days, and a qualified intermediary holds the cash in between so you never touch it.

The caveat: you are deferring, not avoiding. The deferred tax follows into the new property's basis and comes due when you finally sell for cash. But you can keep exchanging, and if you hold until death, the step-up erases it. Model whether the deferral beats just paying with the sell vs. hold vs. 1031 calculator, because for a property with large suspended losses, an outright sale sometimes wins. And if a primary residence is anywhere in the picture (exchanging into a future home, or a former home you converted), the 1031 primary-residence rules are their own rulebook with their own safe harbors.

The lever on your own books: suspended passive losses

Here is the one almost every other article skips. If your rental ever produced losses you could not deduct (because of the passive-loss rules), those losses were suspended and carried forward. A fully taxable sale of that property releases all of them at once, and they offset your gain.

For a property that ran paper losses for years thanks to depreciation, the suspended balance can be five figures, and it comes straight off the taxable gain. The only requirement is that you actually tracked it, year over year, which is exactly the kind of number that gets lost across a decade of returns. This is our wheelhouse, and it is why the sell-versus-1031 math is not obvious: sometimes paying the tax and releasing the losses beats deferring.

The primary-residence exclusion: partial, but real

Move into the rental and make it your primary residence for at least 2 of the 5 years before selling, and Section 121 lets you exclude up to $250,000 of gain ($500,000 married) (Topic 701). Two catches keep it from erasing the whole bill:

  • Nonqualified use: the years it was a rental are prorated out of the exclusion, so a property that was a rental for 8 years and a home for 2 only shelters a fraction.
  • Recapture is never excluded. The depreciation you took still comes back at up to 25%, even on your former home.

It is a strong move if you were going to live there anyway. It is not a clean way to convert a long-held rental to tax-free. The advanced version, stacking the Section 121 exclusion with a 1031 exchange, can shelter more, but it runs on its own five-year clocks.

Installment sale: spread the gain over years

Finance the sale yourself and collect over time, and you report the gain as you receive payments rather than all at once. That can keep you out of the top bracket and under the 3.8% NIIT threshold in any single year. The exception: depreciation recapture is taxed in full in the year of sale, installment or not. Best for a big appreciation gain you want to smooth, less useful when most of your bill is recapture.

The "truly avoid" options

  • Step-up in basis at death. If you hold until you die, your heirs inherit the property at its date-of-death value. The entire gain, recapture included, vanishes. This is why "die holding it" is, unsentimentally, the most complete capital-gains strategy in real estate.
  • Charitable remainder trust. Donate the property to a CRT, which sells it tax-free and pays you income for a term. You avoid the immediate gain and get a partial deduction, at the cost of giving up the remainder to charity.
  • Opportunity zones. Reinvest the gain into a qualified opportunity fund to defer it, and hold the new investment 10+ years for its own appreciation to come out tax-free. A deferral on the old gain, a true exclusion on the new one.

The catch worth repeating

Most of this list defers rather than erases, and depreciation recapture is the part that follows you the hardest. The two moves that truly kill the tax, step-up at death and a 1031-until-death chain, both require holding. Everything else is timing and arithmetic, which is good news: timing and arithmetic are knowable in advance if your basis, your depreciation, and your suspended losses are tracked cleanly.

The takeaway

You can rarely make capital gains tax on a rental vanish at sale, but you can almost always defer it (1031), shrink it (suspended losses, the partial home exclusion), or spread it (installment sale). The right move depends on three numbers most landlords cannot put their hands on quickly: adjusted basis, accumulated depreciation, and the suspended-loss balance. Get those straight, then run the sale both ways in the sell vs. hold vs. 1031 calculator. None of this is tax advice, so confirm the specifics with your CPA, but go into the conversation knowing which lever actually applies to your property.

Frequently asked questions

Do you pay capital gains tax when you sell a rental property?

Usually yes, and on more than you think. The gain is your sale price minus your adjusted basis (original cost plus improvements, minus all the depreciation you took). That gain is taxed in layers: long-term capital gains rates on the appreciation, depreciation recapture at up to 25% on the depreciation you claimed, the 3.8% net investment income tax if your income is high, and state tax on top. The strategies below shrink or defer those layers.

Does a 1031 exchange avoid capital gains tax?

It defers it, not avoids it. A 1031 exchange rolls the entire gain, including depreciation recapture, into a like-kind replacement property, so you owe nothing at the time of sale. But the deferred tax rides along in the new property's basis and comes due when you eventually sell without exchanging again. If you keep exchanging until death, the step-up in basis can wipe it out entirely.

Can I use the home-sale exclusion on a rental property?

Sometimes, partially. If you move into the rental and make it your primary residence for at least 2 of the 5 years before selling, you can exclude up to $250,000 of gain ($500,000 married). But the years it was a rental count as nonqualified use and are prorated out of the exclusion, and depreciation recapture is never excluded. It helps, it does not erase the whole bill.

Is depreciation recapture avoided if I hold the property a long time?

No. Recapture is separate from the capital gain and is not reduced by holding longer, your long-term rate only applies to the appreciation. The depreciation you claimed comes back as unrecaptured Section 1250 gain at up to 25% no matter how long you held. Only a 1031 exchange (defers it) or a step-up at death (erases it) gets rid of recapture.

How do suspended passive losses reduce the tax when I sell?

This is the lever most people forget. Rental losses you could not deduct in prior years are suspended and carried forward, and a fully taxable sale of that property releases all of them at once. Those released losses offset your gain (and other income), often shrinking the tax bill meaningfully. It is real money, but only if you tracked the suspended balance, which is easy to lose over several years.

What is an installment sale?

Seller financing where the buyer pays you over several years. You report the gain as you receive the payments rather than all in the year of sale, which can keep you in a lower bracket each year. Depreciation recapture is the exception: it is taxed in full in the year of sale even on an installment plan.

How do I calculate capital gains when I sell a rental property?

Three steps. First, your adjusted basis: original price plus improvements minus all the depreciation you claimed. Second, your gain: sale price minus selling costs minus that basis. Third, split the gain, because it is not taxed at one rate: depreciation recapture at up to 25% on the depreciation portion, long-term capital gains (0, 15, or 20%) on the appreciation, plus the 3.8% NIIT and state tax. The worked $450,000 example above runs it end to end.

Do you pay capital gains tax on the sale of an investment property?

Almost always, and the rules are the same as for any rental: gain is sale price minus selling costs minus adjusted basis, taxed as capital gains on the appreciation plus depreciation recapture on the depreciation you took. What reduces or defers it is a 1031 exchange, the suspended-loss release, the partial primary-residence exclusion if you move in, an installment sale, or holding until the step-up at death. A straight sale with no planning is fully taxable.