You cannot avoid capital gains tax entirely, but you can reduce what you owe through specific rules built into the tax code
Capital gains tax on real estate is not something you can eliminate by filing a certain form or choosing a certain strategy. It is a tax on profit — the difference between what you paid for the property and what you sold it for. However, the tax code contains several mechanisms that lower the tax you actually pay: a large exclusion for primary homes, the ability to deduct certain costs, the choice between long-term and short-term rates, and rules about what counts as a gain in the first place.
The most common way to reduce capital gains tax on real estate is the primary residence exclusion. If you owned and lived in a home as your main residence for at least two of the five years before you sold it, you can exclude up to $250,000 of gain from tax if you are single, or $500,000 if you are married filing jointly. This exclusion applies once every two years. For many homeowners, this single rule means they owe no federal capital gains tax at all, because their profit falls below the exclusion amount.
Beyond that exclusion, you reduce your taxable gain by deducting the costs of buying, improving, and selling the property. These are not deductions you claim on your tax return — they are subtracted from the sale price before the gain is even calculated. The difference between your adjusted cost basis (what you paid plus improvements) and your sale price is your gain. The lower that number, the lower your tax.
Key Takeaways
- The primary residence exclusion lets you exclude up to $250,000 (single) or $500,000 (married) of gain from tax if you lived in the home for two of the last five years before selling.
- Capital gains tax rates depend on how long you held the property: long-term rates (15 years or more) are lower than short-term rates, which are taxed as ordinary income.
- You reduce your taxable gain by adding capital improvements (renovations, additions, major repairs) to your cost basis, then subtracting that total from your sale price.
- Inherited property receives a "step-up in basis," meaning your cost basis becomes the property's value on the date of death, not what the original owner paid.
- State and local taxes on capital gains vary widely; some states have no capital gains tax, while others tax gains at rates up to 13 percent.
How holding period affects your tax rate
The length of time you own the property determines which tax rate applies to your gain. If you sell within one year of purchase, your gain is short-term capital gain, taxed at the same rate as ordinary income — your regular income tax bracket, which can be 10, 12, 22, 24, 32, 35, or 37 percent depending on your total income. If you hold the property for more than one year, your gain is long-term capital gain, taxed at lower rates: 0, 15, or 20 percent, depending on your income level.
This difference is substantial. A $100,000 gain taxed as short-term capital gain at the 24 percent rate costs $24,000 in federal tax. The same gain taxed as long-term capital gain at the 15 percent rate costs $15,000. The holding period is one of the few things you control directly: waiting longer before selling automatically moves you into a lower tax bracket.
The one-year threshold is firm. You must own the property for more than one year — one year and one day qualifies, but exactly one year does not. For real estate, this is usually not a constraint, because most people do not sell within a year. But if you inherited property or received it as a gift, the clock starts from when you received it, not from when the previous owner bought it.
Adding improvements to your cost basis
Your cost basis is what you paid for the property plus the cost of capital improvements. A capital improvement is a permanent upgrade that adds value to the property, extends its life, or adapts it to a new use. A new roof, a kitchen renovation, an addition, a new HVAC system, or new plumbing all count. Repairs and maintenance do not — painting, fixing a leak, or replacing a broken window are expenses you cannot add to basis.
The distinction matters because every dollar you add to basis reduces your taxable gain by one dollar. If you paid $300,000 for a house, spent $50,000 on a kitchen renovation and $30,000 on a new roof, your basis is $380,000. If you sell for $500,000, your gain is $120,000, not $200,000. That $80,000 reduction in gain saves you $12,000 to $24,000 in federal tax, depending on your rate.
Keep records of all improvements: receipts, invoices, and contracts. The IRS does not require you to submit them when you file, but you must have them if your return is audited. If you cannot document the cost, you cannot add it to basis. For inherited property, improvements made by the original owner before death do not increase your basis — only improvements you make after inheriting do.
The step-up in basis for inherited property
If you inherit real estate, you receive a significant tax advantage called a step-up in basis. Your cost basis becomes the property's fair market value on the date the previous owner died, not what they originally paid for it. If your parent bought a house for $100,000 forty years ago and it is worth $600,000 when they die, your basis is $600,000, not $100,000. If you sell when ready for $600,000, you owe no capital gains tax, because your gain is zero.
This rule applies to the entire property value as of the date of death. It does not matter how long the previous owner held it or how much they paid. The step-up resets the clock and the basis for tax purposes. This is one of the largest tax benefits in the code, and it applies automatically — you do not need to do anything to claim it. The executor or administrator of the estate will report the property's value on the estate tax return (Form 706, if one is required), and that value becomes your basis.
After you inherit, the one-year holding period for long-term capital gains treatment starts fresh. Even if the previous owner held the property for decades, you are treated as a new owner. However, because of the step-up, you usually do not owe tax on gains that occurred before death, only on gains that occur after you inherit.
Deducting selling costs and acquisition costs
When you calculate your gain, you subtract not only what you paid for the property but also the costs of buying and selling it. These include real estate agent commissions, title insurance, recording fees, attorney fees for the purchase, and transfer taxes paid at closing. These are one-time costs that reduce your basis or your sale proceeds, lowering your taxable gain.
Real estate agent commissions are often the largest of these costs, typically 5 to 6 percent of the sale price. If you sell a $500,000 house with a 6 percent commission, that is $30,000 off your gain. Closing costs at purchase — title insurance, appraisal, loan origination fees, attorney fees — also reduce your basis. If you paid $5,000 in closing costs when you bought, your basis increases by $5,000, which reduces your gain by $5,000 when you sell.
You do not claim these as deductions on your tax return. Instead, you report them on Schedule D (Capital Gains and Losses) or Form 8949 (Sales of Capital Assets) when you file. The IRS instructions for these forms walk through the calculation: sale price minus selling costs equals net proceeds; net proceeds minus adjusted basis equals gain.
State and local capital gains taxes
Federal capital gains tax is only part of what you owe. Most states also tax capital gains, and the rates vary widely. Some states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — have no state income tax and therefore no state capital gains tax. Others tax capital gains as ordinary income at rates up to 13 percent. A few states, including California, have separate capital gains taxes on top of income tax.
New York taxes long-term capital gains at rates from 6.85 to 10.9 percent, depending on income. California taxes them at ordinary income rates, up to 13.3 percent. Massachusetts taxes them at 5 percent. If you live in a high-tax state and are selling a property with a large gain, state tax can be as significant as federal tax. If you are considering moving before selling, the state tax difference can be substantial enough to matter.
Some states have special rules for primary residences or for gains below certain thresholds. A few states tax gains only if you are a resident at the time of sale. If you are selling property in a state where you no longer live, you may still owe tax to that state. The rules are complex and vary by state, so consulting a tax professional in your state is worth the cost if your gain is large.
When you might owe tax despite the primary residence exclusion
The $250,000 or $500,000 primary residence exclusion covers most homeowners, but not all. You owe tax on gains above the exclusion amount. If you are single and your gain is $350,000, you owe tax on $100,000. If you are married and your gain is $750,000, you owe tax on $250,000. The exclusion does not eliminate the tax — it just raises the threshold.
You also lose the exclusion if you do not meet the ownership and use test. You must have owned the home and lived in it as your primary residence for at least two of the five years before the sale. If you owned it for five years but lived in it for only one year, you do not may have access to. If you sold a different home within the last two years and already used the exclusion, you cannot use it again until two years have passed.
There are narrow exceptions to the two-year rule. If you sold because of a change in employment, health, or unforeseen circumstances, you may be able to claim a partial exclusion. The IRS defines these circumstances narrowly, and you must file Form 8801 to claim the reduced exclusion. This is one area where a tax professional's guidance is worth the cost, because the rules are specific and the stakes are high.
Frequently Asked Questions
Do I owe capital gains tax if I sell my home for less than I paid for it?
No. If you sell at a loss, you have no gain to tax. Capital losses on personal residences cannot be deducted from other income, so the loss straightforward disappears for tax purposes. However, if you sell rental property or investment property at a loss, you may be able to deduct it against other capital gains or, in some cases, against ordinary income.
What if I inherited a house and sold it a few months later?
You owe no capital gains tax if the sale price equals the property's value on the date of death (your stepped-up basis). If you sold it for more than that value, you owe tax only on the gain above the stepped-up basis. The holding period for long-term rates starts from the date you inherited it, so a sale a few months later is still long-term gain.
Can I deduct the cost of repairs and maintenance from my gain?
No. Only capital improvements — permanent upgrades that add value or extend the property's life — can be added to your basis. Repairs and maintenance are not deductible against capital gains. However, if you own rental property, you can deduct repairs as a business expense on Schedule E, which reduces your rental income.
If I sell investment property, do the same rules explore?
The holding period and long-term versus short-term rates explore the same way. However, investment property does not may have access to for the primary residence exclusion. You owe tax on the entire gain above your basis. You may be able to defer tax using a 1031 exchange (trading one investment property for another), but that is a separate strategy with its own rules and timing requirements.
What happens to capital gains tax if I move to a different state?
You owe federal tax based on your residency at the time of sale. You may also owe tax to the state where the property is located, regardless of where you live. If you sell property in a state you no longer live in, that state may still tax the gain. Some states have agreements to avoid double taxation, but the rules vary. Consulting a tax professional in both states is advisable for large gains.