You cannot avoid capital gains tax entirely, but you can reduce what you owe through specific strategies the IRS allows
Capital gains tax is owed when you sell property for more than you paid for it. The difference between what you paid (your basis) and what you sold it for is your gain, and that gain is taxable income. You cannot make this tax disappear, but the IRS has built several legitimate routes to lower your tax bill or defer it 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 tests.
The strategy you choose depends on what kind of property you are selling, how long you have owned it, and whether you need the money when ready or can wait. Some strategies eliminate tax entirely. Others spread it across years or let you swap properties without paying. A few work only after you die. Understanding which ones explore to your situation can save thousands of dollars.
Key Takeaways
- The primary residence exclusion eliminates tax on up to $250,000 (single) or $500,000 (married) of gain if you owned and lived in the home for at least two of the past five years before selling.
- Installment sales let you spread the gain across multiple tax years instead of reporting it all in the year you sell, which may lower your tax bracket that year.
- Charitable donations of appreciated property avoid capital gains tax on the donation itself and may give you a deduction for the full fair market value.
- A stepped-up basis at death means heirs inherit property at its value on the date of death, erasing all gains that built up during the original owner's lifetime.
- 1031 exchanges allow you to swap one investment property for another without paying tax on the gain, though the rules are strict and timing is tight.
The primary residence exclusion: the most common way to avoid the tax
If you are selling a home you lived in, you may not owe any capital gains tax at all. The primary residence exclusion lets you exclude $250,000 of gain if you are single, or $500,000 if you are married filing jointly and both spouses meet the test. This means if you bought a house for $300,000 and sold it for $700,000, and you are married, your taxable gain is only $200,000 instead of $400,000.
To use this exclusion, you must have owned the home and lived in it as your main home for at least two of the five years before you sold it. The two years do not have to be consecutive, and you can have lived elsewhere during the other years. You can use this exclusion only once every two years, so if you sold a home last year and used the exclusion, you cannot use it again until two years have passed.
Report this exclusion on Schedule D (Form 1040), the form where you report all capital gains and losses. You do not need to file any separate form to claim it — you straightforward calculate your gain, subtract the exclusion amount, and report the remainder as taxable gain. If your gain is less than the exclusion amount, your taxable gain is zero and you owe no federal capital gains tax on that sale. Keep records of when you bought the home, when you sold it, and the dates you lived there, because the IRS may ask for proof that you met the two-year test.
Installment sales: spreading the gain across multiple years
An installment sale is when you sell property but do not receive all the money in the year of sale. Instead, the buyer pays you over time — perhaps over three, five, or ten years. The advantage is that you report the gain in the years you actually receive the payments, not all in the year you sell. This can keep you in a lower tax bracket each year instead of pushing you into a higher one with a large lump-sum gain.
For example, if you sell investment property with a $100,000 gain and receive $20,000 per year for five years, you report $20,000 of gain each year instead of $100,000 in year one. If that $100,000 gain would have pushed you into the 20% long-term capital gains bracket, but spreading it across five years keeps you in the 15% bracket, you save money on taxes. The buyer must sign a promissory note, and you become a lender — you receive interest payments as well as principal, and that interest is taxable as ordinary income.
You must report an installment sale on Form 6252 (Installment Sale Income). The form calculates how much gain to report each year based on the payments you receive. You will need the original purchase price, the sale price, and the payment schedule. This strategy works for both investment property and personal property, though the rules differ slightly. If the buyer defaults on payments, you may have to repossess the property, and the tax consequences can be complicated.
Donating appreciated property to charity instead of selling it
If you own property that has increased in value and you want to support a charity, donating the property itself avoids capital gains tax on the appreciation. You get a tax deduction for the fair market value of the property on the date you donate it, and the charity receives the full value without you having to sell it first and pay tax on the gain.
For example, if you bought stock for $10,000 and it is now worth $50,000, you could sell it and owe capital gains tax on the $40,000 gain. Or you could donate the stock directly to a may have access to charity. You get a deduction for $50,000, the charity gets $50,000 worth of stock, and you pay zero capital gains tax. The deduction may be limited depending on your income and the type of property, but the tax savings on the gain itself are real. This works especially well if you have appreciated stock, mutual funds, or real estate that you no longer want to hold.
You must donate to a may have access to charity — the IRS maintains a searchable list on its website at irs.gov. You will need a written appraisal of the property's value and must file Form 8283 (Noncash Charitable Contributions) with your tax return. For property worth over $5,000, you need a may have access to appraiser's statement. This strategy works well for real estate, stock, and other appreciated assets, but not for property you donated and then used yourself.
Stepped-up basis at death: the gain disappears for heirs
When you inherit property, its basis (the value used to calculate future gains) is stepped up to its fair market value on the date of the original owner's death. This means all the gain that built up during the original owner's lifetime is erased. If your parent bought a house for $100,000 and it was worth $400,000 when they died, your basis is $400,000, not $100,000. If you sell it the next year for $410,000, your gain is only $10,000, not $310,000.
This is not something you do — it happens automatically when you inherit. The executor or administrator of the estate reports the property's value on the estate tax return (if one is required), and that value becomes your basis. You do not need to file any special form to claim the stepped-up basis; it is built into how inherited property is treated. The stepped-up basis applies to real estate, stock, and most other property types, though the rules vary slightly by state.
This strategy only works if the property passes through an estate or trust at death. Property that passes by beneficiary designation (like a payable-on-death bank account) or by operation of law (like joint tenancy property) may not receive a stepped-up basis, so the rules depend on how the property is titled and your state's laws. Some states have community property rules that affect how stepped-up basis works for married couples.
1031 exchanges: deferring tax by swapping investment properties
A 1031 exchange (named after the section of the tax 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 gain is not erased — it is deferred until you eventually sell the replacement property without doing another exchange. This can let you build wealth in real estate without paying tax along the way.
The rules are tight. You have 45 days from the sale of the old property to identify the new property you want to buy, and 180 days to close on it. The new property must be of equal or greater value, and it must be held for investment or business use (not personal use). You cannot do a 1031 exchange on your primary residence. You must use a may have access to intermediary — a third party who holds the sale proceeds and buys the new property on your behalf — and you cannot touch the money yourself or the exchange fails.
Report a 1031 exchange on Form 8824 (Like-Kind Exchanges). You will need the details of both properties, the sale price, the purchase price, and the intermediary's information. If you fail to meet the timing or property requirements, the entire gain becomes taxable in the year of sale, so this strategy requires careful planning and professional help. Many real estate investors use 1031 exchanges repeatedly to defer tax for decades, though eventually the tax is owed unless the property passes to an heir.
Losses and basis adjustments: lowering your gain before you sell
You cannot reduce a gain that already exists, but you can lower your basis (the amount you paid) through certain adjustments, which lowers the gain when you eventually sell. If you made capital improvements to the property — a new roof, a kitchen renovation, an addition — you can add those costs to your basis. This increases what you "paid" for the property, which decreases your gain.
For example, if you bought a rental house for $200,000 and spent $50,000 on improvements, your basis is $250,000. If you sell it for $400,000, your gain is $150,000 instead of $200,000. Keep receipts and invoices for all improvements. Repairs and maintenance do not count — only improvements that add value or extend the life of the property. The IRS distinguishes between fixing something broken (a repair) and making it better or new (an improvement), and only improvements increase your basis.
You can also deduct depreciation on investment property and rental property, which lowers your basis over time. This creates a tax benefit while you own it, but when you sell, you must recapture that depreciation and pay tax on it at a higher rate (25% instead of 15% or 20%). This is not a way to avoid tax — it is a way to defer it and potentially pay more later. The tax savings from depreciation deductions are often offset by the higher recapture rate when you sell.
What does not work: common myths about avoiding capital gains tax
Some strategies people believe work do not. You cannot avoid capital gains tax by holding the property for a certain length of time beyond the long-term holding period (more than one year). Long-term gains are taxed at lower rates than short-term gains, but the tax is still owed. You cannot avoid it by reinvesting the proceeds into another property unless you do a 1031 exchange with the specific rules followed. You cannot avoid it by gifting the property to a family member — the recipient inherits your basis, not a stepped-up basis, unless you die first.
You also cannot avoid it by claiming the property is your primary residence if you actually used it as a rental or investment property. The IRS looks at how you actually used the property, not how you claim to have used it. If you rented it out for five years and then moved in for one year before selling, you cannot use the primary residence exclusion for the entire gain. The IRS has specific tests for what counts as your main home, and claiming otherwise can trigger an audit and penalties.
Frequently Asked Questions
Can I use the primary residence exclusion if I am selling a vacation home or rental property?
No. The exclusion applies only to your main home — the place where you lived most of the time. A vacation home or rental property does not may have access to, even if you stayed there occasionally. If you converted a rental property to your primary residence, you can use the exclusion only for the years you actually lived there, not the years you rented it out.
What if I sell the property at a loss instead of a gain?
If you sell investment property or business property at a loss, you can deduct the loss against other capital gains. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against ordinary income in that year, and carry forward any remaining loss to future years. Personal property losses (like a primary residence) cannot be deducted at all.
Do I have to report the sale if my gain is less than the primary residence exclusion?
You still must file Schedule D and report the sale, even if your taxable gain is zero. The IRS wants a record of all property sales. However, if your gain is completely covered by the exclusion, you will owe no tax on it.
Can I do a 1031 exchange on my primary residence?
No. A 1031 exchange works only for investment or business property. Your primary residence does not may have access to. If you want to defer tax on the sale of a home, the primary residence exclusion is your only option, and it eliminates tax rather than deferring it.
What happens if I miss the 45-day identification important date for a 1031 exchange?
If you miss the 45-day important date to identify the replacement property, the exchange fails and the entire gain becomes taxable in the year of sale. The important date is strict — the IRS does not grant extensions. You must identify the property in writing to the may have access to intermediary by day 45, even if you have not closed on it yet.