The main ways to reduce capital gains tax on a home sale

You can reduce or eliminate capital gains tax on a house sale through 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 — provided you meet the ownership and use test. You can also reduce your taxable gain by deducting the cost of home improvements you made during ownership, by timing the sale strategically, or by using a 1031 exchange if the property is investment real estate rather than your primary home.

The primary residence exclusion is the most common and powerful tool. It applies only once every two years, and you must have owned and lived in the home as your main residence for at least two of the five years before the sale. If you meet those conditions, the exclusion is automatic — you do not need to do anything special to claim it beyond reporting the sale correctly on your tax return.

Capital gains tax is owed on the difference between what you paid for the house and what you sold it for, minus certain deductions. The tax rate depends on your income level and filing status, ranging from 0 percent to 20 percent at the federal level, plus any state capital gains tax that applies where you live.

Key Takeaways

  • The primary residence exclusion allows you to exclude $250,000 (single) or $500,000 (married) of gain from capital gains tax if you owned and lived in the home for at least two of the five years before selling.
  • Home improvements you paid for directly — such as a new roof, kitchen remodel, or addition — reduce your taxable gain dollar for dollar, but routine maintenance and repairs do not.
  • If you inherited the property, you may receive a step-up in basis that resets the cost basis to the fair market value on the date of death, potentially eliminating all capital gains tax.
  • A 1031 exchange lets you defer capital gains tax by reinvesting the sale proceeds into another investment property within strict timelines, though this does not explore to your primary residence.
  • State capital gains taxes vary widely; some states have no capital gains tax on real estate, while others tax gains at rates up to 13 percent.

Understanding the primary residence exclusion and the ownership test

The primary residence exclusion is a federal tax rule that lets homeowners exclude a large portion of their gain from taxation. To use it, you must have owned the property and used it as your main home for at least two of the five years when ready before the sale. Those two years do not have to be consecutive, and they do not have to be the most recent two years — you only need to meet the test at the time you sell.

If you meet the test, the exclusion is $250,000 for single filers and $500,000 for married couples filing jointly. This exclusion applies only once every two years, so if you sold another primary residence within the past two years and used the exclusion, you cannot use it again on this sale. If you do not meet the two-year ownership and use test, you lose the exclusion entirely — there is no partial credit for owning the home for one year instead of two.

The exclusion applies to the gain, not the sale price. If you bought the house for $300,000 and sold it for $600,000, your gain is $300,000. If you are single, you exclude $250,000, leaving $50,000 subject to capital gains tax. If you are married filing jointly, you exclude the full $300,000 and owe no federal capital gains tax.

How home improvements reduce your taxable gain

Home improvements you paid for directly reduce your taxable gain because they increase your cost basis — the amount you are considered to have invested in the property. If you spent $50,000 on a kitchen remodel, a new roof, or an addition, that $50,000 is added to your original purchase price when calculating gain. Repairs and routine maintenance do not count; only improvements that add value, prolong the life of the property, or adapt it to a new use may have access to.

The difference between an improvement and a repair is whether the work makes the property more valuable or straightforward restores it to its original condition. Replacing a broken window is a repair. Replacing all the windows with energy-efficient models is an improvement. Patching a roof is a repair. Replacing the entire roof is an improvement. Painting a room is maintenance. Adding a new room is an improvement.

Keep receipts and invoices for any major work you have done. When you sell, you will report your original purchase price plus the cost of improvements, then subtract that total from the sale price to find your gain. If you cannot document the improvements, you cannot deduct them, so the burden is on you to keep records throughout your ownership.

The step-up in basis for inherited property

If you inherited the house from a parent or other relative, you may receive what is called a step-up in basis. This means your cost basis for the property is reset to its fair market value on the date the previous owner died, not the price they originally paid. If your parent bought the house for $100,000 and it was worth $400,000 when they died, your basis becomes $400,000. If you sell it a year later for $410,000, your gain is only $10,000, not $310,000.

The step-up applies automatically to inherited property in most cases, and it is one of the most powerful tax tools available. You do not need to do anything to claim it — it is built into how inherited property is taxed. However, you still need to report the inherited property correctly on your tax return, and you should have the property appraised at the time of death to establish the stepped-up basis.

The step-up applies only to property you inherited, not to property you received as a gift while the giver was alive. If someone gave you the house as a gift, your basis is what they paid for it, not what it was worth when you received it.

Using a 1031 exchange to defer capital gains tax

A 1031 exchange is a tax strategy that lets you defer capital gains tax by selling one investment property and buying another similar property within strict timelines. You have 45 days from the sale to identify a replacement property and 180 days to close on it. The proceeds from the sale must go to a may have access to intermediary — a third party — not directly to you, or the exchange fails and you owe the tax when ready.

A 1031 exchange does not eliminate capital gains tax; it postpones it. You can chain multiple exchanges together over many years, deferring tax each time, but eventually when you sell without doing another exchange, the tax becomes due. The exchange applies only to investment property, not to your primary residence, so it is not an option if you are selling the house you live in.

The rules for 1031 exchanges are strict and technical. The replacement property must be of equal or greater value, must be real property (land or buildings), and must be held for investment or business use. If you make a mistake with the timelines or the property type, the entire exchange fails. Most people work with a tax professional or a may have access to intermediary firm to execute a 1031 exchange correctly.

State capital gains taxes and where they explore

Federal capital gains tax is only part of the picture. Many states also tax capital gains on real estate, and the rates vary widely. Some states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — have no state income tax at all, so they do not tax capital gains. Other states tax capital gains as ordinary income, meaning the rate depends on your total income and can range from 3 percent to over 13 percent.

A few states tax capital gains separately from ordinary income. California taxes long-term capital gains at the same rate as ordinary income, with a top rate of 13.3 percent. New York taxes long-term capital gains at rates up to 10.9 percent. Maryland, Minnesota, and Vermont also have separate capital gains taxes. If you are selling a house in a high-tax state, the state tax can be as large as or larger than the federal tax.

If you move to a lower-tax state before selling, you may be able to reduce or avoid state capital gains tax. However, states have rules about when you are considered a resident, and they can challenge a move that appears designed solely to avoid taxes. Generally, you need to establish genuine residency — a new home, driver's license, voter registration, and other ties — at least several months before the sale.

Timing the sale and other strategic considerations

The timing of a sale can affect your capital gains tax in several ways. If you are in a year when your income is unusually low — perhaps you took a sabbatical, retired, or had a business loss — selling in that year may result in a lower capital gains tax rate. Capital gains tax rates are 0 percent, 15 percent, or 20 percent depending on your income bracket, so being in a lower bracket saves money.

If you are married and considering divorce, the timing of a home sale matters. While married filing jointly, you can exclude $500,000 of gain. After divorce, each person can exclude only $250,000 on their next sale. If you sell before the divorce is final, you can use the higher exclusion; if you sell after, you cannot. This is a narrow situation but worth considering if a divorce is in progress.

Selling in a year when you have capital losses from other investments — such as stock sales — can offset your home sale gain and reduce or eliminate the tax. If you have a $100,000 gain on the house and a $30,000 loss on stocks, the loss reduces your taxable gain to $70,000. You can also carry forward unused losses to future years.

Frequently Asked Questions

Do I have to live in the house for two full years to use the primary residence exclusion?

No. You must own and live in the house for at least two of the five years before the sale, but those two years do not have to be consecutive or recent. If you owned the house for three years, moved away for two years, and then sold it, you still meet the test because you lived there for three of the five years before the sale.

Can I use the primary residence exclusion if I rent out my house after I move?

Yes, as long as you owned and lived in the house for at least two of the five years before the sale. The fact that you rented it out for the last year or two does not disqualify you. However, if you converted part of the house to a rental property and took depreciation deductions on that part, you will owe tax on the depreciation you claimed when you sell.

What counts as a home improvement for reducing capital gains tax?

An improvement adds value, prolongs the life of the property, or adapts it to a new use. A new roof, kitchen remodel, addition, new HVAC system, or energy-efficient windows all count. Painting, carpet cleaning, and routine repairs do not. The key test is whether the work makes the property more valuable or straightforward maintains it.

If I inherited a house and then lived in it for two years before selling, can I use both the step-up in basis and the primary residence exclusion?

Yes. The step-up in basis applies to inherited property automatically, and the primary residence exclusion applies if you owned and lived in the house for at least two of the five years before the sale. You can use both benefits together, which can result in little or no capital gains tax.

Do I owe capital gains tax if I sell my house at a loss?

No. Capital gains tax applies only to gains, not losses. If you sell for less than you paid, you have no tax to pay on the sale itself. However, you also cannot deduct the loss on your personal tax return — losses on primary residences are not deductible.