
Summary
Capital gains tax can significantly reduce the profit you walk away with after selling real estate—but with the right strategy, much of that tax can be reduced, deferred, or strategically managed. While some homeowners qualify for exclusions under IRS rules, experienced investors rely on a combination of long-term holding strategies, cost basis optimization, 1031 exchanges, and advanced planning techniques to preserve wealth.
The key is understanding that capital gains taxes are rarely “eliminated”—they are deferred, minimized, or repositioned through smart planning. Factors such as how long you’ve owned the property, whether it’s a primary residence or investment, your income level, and how you structure reinvestment all play a major role in determining your tax outcome.
In this guide, you’ll learn how capital gains taxes work, when they apply, and the most effective IRS-approved strategies real estate investors use to legally reduce their tax burden and keep more of their profits.
Federal capital gains taxes—reaching as high as 37%—can take a significant bite out of your real estate profits. Fortunately, many investors already qualify for exemptions or strategies that can dramatically reduce or defer what they owe. Understanding how capital gains taxes work, when they apply, and which IRS rules you can legally leverage is essential for protecting your investment returns.
This guide explains how to avoid capital gains tax on real estate, including primary residence exclusions, long-term ownership benefits, 1031 exchanges, reinvestment strategies, and other IRS-approved methods to keep more of your profit in your pocket.
Key Takeaways on Avoiding Capital Gains Tax
- Understanding Capital Gains Tax: Capital gains taxes are fees that real estate investors must pay after selling a property. They are calculated based on the profit made from the sale, i.e., the difference between the purchase price and the selling price of the real estate.
- Who Pays Capital Gains Tax: The IRS requires payment of capital gains tax upon selling an asset under certain conditions. These include scenarios where the property is a second home (investment, vacation, or rental), when the property has been owned for less than two years within a five-year period, or when the home was lived in for less than two years in the five years before selling. The specific rate depends on various factors such as income tax bracket, marital status, duration of property ownership, and whether it was a primary or secondary residence.
- Avoiding Capital Gains Tax: Strategies to avoid or reduce capital gains tax on real estate include waiting at least a year before selling a property (qualifying for long-term capital gains), taking advantage of primary residence exclusions, rolling profits into a new investment via a 1031 exchange, itemizing expenses, choosing properties in opportunity zones, and timing the sale of the property for a period when income is lowest.
- Deferring Capital Gains Tax: Buying another home after selling an investment property within 180 days can defer capital gains taxes. Although reinvesting the proceeds from a sale still obligates the payment of capital gains, it can defer them. Taxes cannot be completely avoided by reinvesting in real estate, but they can be deferred by investing in similar real estate property1.
- The Two-Out-of-Five-Year Rule: According to this rule, one doesn’t need to live in a home for five consecutive years to qualify for tax exemptions. Living in a home cumulatively for two out of the five years before selling can qualify one for capital gains tax exclusions of $250,000 per person or $500,000 per couple.
What Is Capital Gains Tax on Real Estate, and How Is It Calculated?
Capital gains tax is calculated on the difference between your sale price and your adjusted cost basis — not your original purchase price alone. Your basis starts with what you paid for the property, increases with the cost of qualifying capital improvements, and decreases by any depreciation you’ve claimed if the property was used as a rental or business asset. Selling costs, including real estate commissions, legal fees, and certain closing costs, further reduce your taxable gain, which is why accurate recordkeeping throughout your ownership period directly translates into a smaller tax bill at sale.
How that gain is taxed depends heavily on how long you owned the property. Property held for one year or less generates a short-term capital gain, taxed at your ordinary income rate — which can run as high as 37% for top earners, making a hasty sale within the first twelve months of ownership one of the costliest timing mistakes an investor can make. Property held for more than one year qualifies for long-term capital gains treatment, taxed at 0%, 15%, or 20% depending on your total taxable income, a rate structure that can cut your tax bill by more than half compared to the short-term alternative for the exact same dollar amount of profit.
For rental and investment property, two additional layers frequently apply that many general guides overlook. Depreciation recapture taxes back, at a flat 25% rate, the portion of your gain attributable to depreciation deductions you claimed while you owned the property — the IRS’s reasoning being that you already received a tax benefit from those deductions during ownership, and recapture claws part of it back at sale. Separately, the Net Investment Income Tax adds a 3.8% surtax on investment income, including capital gains, for single filers with modified adjusted gross income above $200,000 and married couples above $250,000 — meaning a high-income seller can face a genuine top marginal rate approaching 24% on a rental sale before any state tax is even considered.
Who Pays Capital Gains Taxes?
The IRS requires you to pay capital gains taxes anytime you sell an asset. The federal government requires sellers to pay capital gains if:
- The home was a second property (investment, vacation, or rental)
- You owned the home for less than two years within a five-year period
- You lived in the home for less than two years in the five years before selling
- You have already claimed your exemption on another property within the last two years
- You buy the property through a 1031 exchange
The specific rate you pay depends on your income tax bracket, marital status, how long you’ve owned the property, and whether it was your primary or secondary residence. You can get an exemption if you sell your primary residence but can only claim it once every two years.
Learn about Real Estate & Asset Protection at our next
FREE LIVE STREAM
How To Avoid Capital Gains Tax on Real Estate
Capital gains taxes can quickly cut into your real estate profits. If you plan to buy and sell several properties for profit, you’ll want to consider how to avoid capital gains tax on real estate.
A few techniques can help you avoid expensive capital gains, including:
- Wait before selling: Buying and selling a property within a year is considered a short-term capital gain. Waiting at least a year before selling, if you can manage the monthly costs, can help reduce your tax liabilities by qualifying you for long-term capital gains.
- Take advantage of primary residence exclusions: All states offer exemptions on tax liability when selling your primary residence. To qualify, you must own and reside on the property for a specified time. If you can improve its value while living on-site, you might qualify for a $250,000 (single) or $500,000 (married) exemption.
- Roll your profits into a new investment: A 1031 exchange allows you to roll your real estate profits into a similar investment type. However, the requirements for a 1031 exchange are often more in-depth than your other options. A 1031 tax-deferred exchange might also be an option if you’re selling real estate at a loss.
- Itemize your expenses: Itemizing your expenses, including construction, equipment, repairs, and sale costs, can help you decrease your tax liability. You’re only required to pay capital gains on your profits.
- Strategically plan where to buy: Strategically choosing properties in opportunity zones can help you manage capital gains costs. These zones are often distressed areas that could use improvements, so you can do good for the local community while also reducing your out-of-pocket costs.
- Choose your sale date carefully: Timing the sale of your property for a period when your income is at its lowest can also help you avoid capital gains taxes. The IRS charges as little as 0% on capital gains if your income is lower than $80,000.
Considering these options before choosing a property and creating a timeline can help you manage your tax liabilities. Combining multiple strategies, such as buying in an opportunity zone and timing your sale wisely, can help you keep more profits in your pockets.
Which Strategy Fits Your Situation? Primary Residence vs. Rental vs. Investment Property
The right capital gains strategy depends almost entirely on what kind of property you’re selling and what you intend to do with the proceeds. A homeowner selling the house they’ve lived in typically looks first to the Section 121 primary residence exclusion, which can eliminate the tax bill entirely for many sellers without requiring any reinvestment at all. An investor selling a rental or investment property generally cannot use that exclusion and instead relies on deferral tools — most commonly a 1031 exchange, though installment sales, Qualified Opportunity Funds, and passive loss offsets are all viable depending on whether the investor wants to remain in real estate or exit the asset class entirely. Inherited property follows an entirely different logic, since heirs typically receive a stepped-up basis to the property’s fair market value at the date of death, which can eliminate the built-in gain that accumulated during the original owner’s lifetime regardless of how the property is eventually sold.
Not sure which category your property falls into, or whether you can combine strategies? Download Anderson Advisors’ free Real Estate Asset Protection guide to see how tax planning and legal structure work together.
Selling Your Primary Residence: The Section 121 Exclusion
If the property you’re selling has genuinely been your home, the Section 121 exclusion is usually the single most powerful tool available, allowing single filers to exclude up to $250,000 of gain from taxation and married couples filing jointly to exclude up to $500,000 — figures large enough to eliminate the entire tax bill for the majority of home sellers outright. To qualify, you must satisfy the ownership and use test: you must have owned and lived in the home as your primary residence for at least two of the five years immediately preceding the sale, and those two years do not need to be continuous, so long as they add up to at least twenty-four months in aggregate. You can generally only claim this exclusion once every two years, which matters for anyone who has sold and excluded gain on a different property recently.
Consider a straightforward example: a single filer bought a home for $300,000 and, after owning and living in it for three of the last five years, sells it for $600,000. The $300,000 gain falls entirely within the $250,000 exclusion for the first portion, leaving $50,000 of taxable gain — and if that filer’s taxable income for the year otherwise falls in the 0% long-term capital gains bracket, the remaining gain may not generate any federal tax at all. A married couple in the identical scenario would owe nothing, since their full $300,000 gain sits comfortably beneath the $500,000 joint exclusion. Members of the military, foreign service, and intelligence community are permitted to calculate the two-year use test differently to account for deployment periods, which is a frequently overlooked accommodation worth confirming with an advisor if it applies to you.
Deferring Capital Gains on Rental and Investment Property: The 1031 Exchange
For investors who want to stay invested in real estate rather than cash out, the 1031 exchange remains the workhorse strategy for deferring — not eliminating — capital gains tax, potentially indefinitely, as long as proceeds continue rolling from one qualifying property into another. The mechanics are unforgiving on timing: after closing the sale of the relinquished property, you have exactly 45 days to formally identify potential replacement properties and 180 days total to close on the replacement, and the sale proceeds must pass through a qualified intermediary rather than touching your hands directly, or the exchange is disqualified entirely. To fully defer the tax, the replacement property generally needs to be of equal or greater value than the property sold, since any difference — known as “boot” — becomes immediately taxable.
Consider an investor who sells a rental for $500,000 and, within the required windows, closes on a replacement property for $650,000 using a qualified intermediary throughout; no capital gains tax is due on the exchange, and the same deferral can repeat indefinitely on future sales, with the tax obligation only crystallizing if the investor eventually sells without exchanging into a new property. For investors who don’t want to take on the operational complexity of identifying and closing on a full replacement property within these tight windows, a less formal approach sometimes called a “lazy” 1031 uses suspended passive losses or newly generated passive losses from other properties to offset part of the taxable gain — it isn’t a true exchange and doesn’t defer tax the way a real 1031 does, but it’s a legitimate way to reduce the bill using losses an investor may already have sitting on the table.
Reducing Your Taxable Gain: Cost Basis, Capital Losses, and Timing
Even when full deferral isn’t available or desired, several strategies reduce the taxable gain itself rather than deferring it. Every dollar spent on qualifying capital improvements — a new roof, a kitchen remodel, an addition — increases your cost basis and correspondingly shrinks your taxable gain, and closing costs, broker commissions, and staging expenses tied directly to the sale reduce it further; investors who keep organized records of these expenditures throughout ownership routinely save thousands of dollars that a seller relying on memory alone simply loses. Capital losses from other investments, including stocks or other real estate sold at a loss in the same tax year, offset capital gains dollar for dollar, and if losses exceed gains, up to $3,000 can offset ordinary income annually with the remainder carrying forward to future years — a seller with a $50,000 real estate gain and $35,000 in stock losses from the same year, for instance, reduces the taxable portion to just $15,000 without altering the property transaction itself in any way.
Because long-term capital gains rates are tied directly to total taxable income for the year, timing a sale to coincide with a lower-income year — retirement, a career transition, or a year with unusually high deductions — can meaningfully lower or even eliminate the applicable rate; some sellers whose taxable income falls beneath the relevant threshold pay a 0% federal rate on the gain entirely. Coordinating the timing of a sale with a spouse’s income, or deliberately stacking deductions into the same tax year as the sale, are both legitimate ways to influence which bracket the gain ultimately falls into.
How Entity Structure Affects Your Capital Gains Outcome
Every strategy discussed so far assumes the sale itself, but how a property is held throughout ownership meaningfully shapes the eventual tax and liability picture, which is territory most capital gains guides skip entirely. Cost segregation studies and bonus depreciation, for example, accelerate depreciation deductions early in the holding period to reduce taxable income while the property is generating cash flow — a legitimate and widely used strategy, but one that directly increases the amount of depreciation recapture owed at sale, meaning the decision to pursue aggressive depreciation should be made with a clear view of the eventual exit strategy, not in isolation. An investor who plans to exchange into a new property indefinitely may reasonably accept a larger recapture exposure they intend to keep deferring, while an investor planning to sell and exit real estate entirely within a few years should model that recapture bill carefully before accelerating deductions.
Entity choice also affects practical execution. Real estate held directly in an investor’s own name exposes that investor personally to liability tied to the property and complicates the clean chain of ownership that a 1031 exchange or installment sale ideally requires; property held inside a properly structured LLC, by contrast, compartmentalizes liability from an investor’s other assets and can simplify the documentation a qualified intermediary or title company needs during a time-sensitive exchange. For investors converting a former primary residence into a rental property before selling, IRS guidance under Revenue Procedure 2005-14 allows certain sellers to combine the Section 121 exclusion with a 1031 exchange on the same property under specific conditions — a sophisticated, frequently underused strategy that illustrates exactly why these tools should be evaluated together as part of a coordinated plan rather than selected individually and applied in isolation.
Curious how your current LLC or trust structure interacts with your capital gains exposure? Learn more about Anderson Advisors’ Real Estate Asset Protection planning and see how a tailored structure fits your portfolio.
Capital gains tax on real estate is rarely something you eliminate through a single tactic discovered after the fact — it’s something you plan around from the moment you acquire a property, using holding period, entity structure, and depreciation strategy as inputs to an outcome you can largely control by the time you decide to sell. The investors who keep the most of their profit aren’t the ones who stumble onto the right strategy at closing; they’re the ones who understood which tools applied to their situation well before the for-sale sign went up, and who built their ownership structure to support whichever exit strategy they eventually chose.
Frequently Asked Questions about Capital Gains Tax

How Long Do I Have to Buy Another House to Avoid Capital Gains?
You might be able to defer capital gains by buying another home. As long as you sell your first investment property and apply your profits to the purchase of a new investment property within 180 days, you can defer taxes. You might have to place your funds in an escrow account to qualify.
Do I Pay Capital Gains if I Reinvest the Proceeds From the Sale?
While you’ll still be obligated to pay capital gains after reinvesting proceeds from a sale, you can defer them. Reinvesting in a similar real estate investment property defers your earnings as well as your tax liabilities.
Can You Avoid Capital Gains Tax by Reinvesting in Real Estate?
You can’t avoid capital taxes by reinvesting in real estate. You can, however, defer your capital gains taxes by investing in similar real estate property.
What Is the Two-Out-of-Five-Year Rule?
The two-out-of-five-year rule means you don’t have to live in a home for five consecutive years to qualify for tax exemptions. As long as you live in a home cumulatively for two out of the five years before selling, you might qualify for capital gains tax exclusions of $250,000 per person or $500,000 per married couple.
What Is the Difference Between Short and Long-Term Capital Gains?
Capital gains taxes range between 0% and 37%. The average capital gains rate is lower for long-term gains than short-term. A short-term capital gain includes buying, selling, and earning profits on an asset you have owned for a year or less. A long-term capital gain is a profit from an investment you have owned for more than a year. Therefore, waiting to sell your real estate asset could save you money.
Want to discuss the tips in this guide: How to avoid capital gains tax on real estate in detail? Do you have more questions about your capital gains tax liabilities before buying or selling a real estate asset? Contact us at Anderson Legal, Business, and Tax Advisors for your free strategy session today.
Receive a detailed risk assessment to assist in lowering problem areas that could wipe out all of your assets with one wrong move. Speak with an Anderson Professional Advisor to get your FREE Strategy Session. Limited-Time Offer: FREE (a $750 value.)



