The main way to avoid capital gains tax on a home sale is the Section 121 exclusion, which lets you exclude up to $250,000 of profit if you're single, or $500,000 if you're married filing jointly—but only if you meet specific ownership and use requirements
When you sell a house for more than you paid for it, the profit is called a capital gain, and the IRS taxes it. However, the federal government offers a major exception: the Section 121 exclusion. If you owned and lived in the house as your primary residence for at least two of the five years before the sale, you can exclude $250,000 of profit from taxation (or $500,000 if you're married filing jointly). This means many homeowners pay zero federal tax on the sale.
The exclusion applies only to your primary residence—the house where you actually live most of the time. It does not explore to investment properties, vacation homes, or rental properties. You can use this exclusion once every two years, so if you sold a house and used the exclusion, you cannot use it again until two years have passed.
State and local taxes on home sales vary widely. Some states have no capital gains tax at all; others tax it like federal income. Some cities charge a transfer tax when you sell. These taxes cannot be avoided the same way federal tax can, but understanding what your state requires is the first step to planning.
Key Takeaways
- The Section 121 exclusion lets you exclude up to $250,000 (single) or $500,000 (married) of home sale profit from federal tax if you owned and lived in the house for two of the last five years.
- If your profit exceeds the exclusion amount, the excess is taxed as a long-term capital gain at federal rates of 0%, 15%, or 20%, depending on your income.
- State and local capital gains taxes, transfer taxes, and property taxes at sale vary by location and cannot be avoided through the Section 121 exclusion.
- If you did not meet the two-year ownership and use test, you may still may have access to for a partial exclusion if you sold due to a job change, health issue, or unforeseen circumstance.
- Keeping records of home improvements, your purchase price, and sale price is essential for calculating your actual profit and tax liability.
Understanding the Section 121 exclusion and who qualifies
The Section 121 exclusion is a federal tax break written into the Internal Revenue Code. To use it, you must meet two tests: the ownership test and the use test. You must have owned the house for at least two of the five years before you sold it. You must have lived in it as your main home for at least two of those same five years. The two years do not have to be consecutive, and they do not have to be the two years when ready before the sale.
If you are married and file a joint return, you can exclude up to $500,000 of profit. Both spouses must meet the ownership test, but only one spouse needs to meet the use test. If you are single, divorced, or widowed, the limit is $250,000. If you are married but file separately, each spouse can exclude only $250,000, and both must meet both tests.
You can claim the exclusion only once every two years. If you sold a house in 2022 and used the exclusion, you cannot use it again until 2024. This rule prevents people from flipping houses and avoiding tax on every sale.
What happens if your profit exceeds the exclusion amount
If your profit is less than $250,000 (or $500,000 if married), you owe no federal capital gains tax. If your profit is higher, the amount above the exclusion is taxed as a long-term capital gain. Long-term capital gains are taxed at lower rates than ordinary income: 0%, 15%, or 20% depending on your total income for the year.
Your profit is the sale price minus your adjusted basis. Your basis is what you paid for the house, plus the cost of major improvements (a new roof, a deck, a kitchen remodel), minus any depreciation you claimed if you rented out part of the house. It does not include repairs or maintenance, even if they were expensive. The difference between your adjusted basis and the sale price is your gain.
For example: you bought a house for $300,000, spent $50,000 on improvements, and sold it for $700,000. Your adjusted basis is $350,000. Your gain is $350,000. You exclude $250,000 (or $500,000 if married), leaving $0 to $100,000 taxable. That taxable amount is taxed at the long-term capital gains rate for your income bracket.
How to may have access to for a partial exclusion if you did not meet the two-year test
If you owned or lived in the house for less than two years, you normally cannot use the Section 121 exclusion. However, the IRS allows a partial exclusion if you sold because of a job change, a health issue, or an unforeseen circumstance. The exclusion is reduced based on how long you actually owned and used the house.
A job change means a new job that required you to move more than 50 miles away. A health issue means you needed to move to be closer to medical care or to a different climate. An unforeseen circumstance includes divorce, death of a spouse or dependent, loss of employment, or damage to the house from a natural disaster or accident.
To claim a partial exclusion, you must file Form 8949 (Sales of Capital Assets) and Form 1040 Schedule D with your tax return. You will need to document the reason for the sale. Keep records of the job offer letter, medical records, divorce decree, or other proof. If the IRS questions the claim, you will need to show that the reason was genuine and that the sale was necessary.
State and local taxes you cannot avoid with the Section 121 exclusion
The Section 121 exclusion applies only to federal tax. Most states do not have a capital gains tax on home sales, but some do. California, Oregon, Washington, New York, and a few others tax capital gains at ordinary income rates. If you live in one of these states, you will owe state tax on any profit above the exclusion, even if you owe no federal tax.
Many cities and counties charge a transfer tax or sales tax when you sell real estate. This is a small percentage of the sale price (usually 1% to 3%) and is paid at closing. This tax is separate from capital gains tax and cannot be reduced by the Section 121 exclusion. It is a cost of the sale itself, not a tax on profit.
Some states also tax the sale of a primary residence if you owned it for less than a certain time or if you are not a resident. Check your state's Department of Revenue website or speak with a tax professional in your state to understand what you owe.
How to calculate your profit and keep records
To know whether you owe tax, you must calculate your actual profit. Start with your purchase price—what you paid for the house. Add the cost of any capital improvements: a new roof, new windows, a deck, a finished basement, a kitchen or bathroom remodel, a new HVAC system, or new plumbing. Do not include repairs (fixing a leak, repainting, replacing broken glass) or maintenance (lawn care, cleaning).
Subtract any depreciation you claimed if you rented out part of the house or used it as a home office. This gives you your adjusted basis. Subtract the adjusted basis from your sale price. The result is your gain. If the gain is less than $250,000 (or $500,000 if married), you owe no federal tax. If it is higher, the excess is taxable.
Keep all receipts and invoices for improvements. Keep the original purchase agreement and the final sale statement from closing. Keep records of any major repairs or maintenance, even though they do not reduce your basis, because they may help prove that an improvement was necessary. If you are audited, the IRS will ask for these documents.
When to talk to a tax professional about your home sale
If your profit is below the exclusion limit and you meet the two-year ownership and use test, you likely do not need professional help. You can report the sale on Form 8949 and Schedule D yourself.
You should talk to a tax professional if: your profit exceeds the exclusion amount; you did not meet the two-year test and think you may have access to for a partial exclusion; you live in a state with capital gains tax; you owned the house with someone else and are not sure how to split the basis; you rented out part of the house or claimed a home office deduction; or you are unsure whether an expense counts as an improvement or a repair. A tax professional can also help you understand state and local taxes in your area.
A CPA or tax attorney can review your records before you sell and tell you what to expect. They can also help you plan if you are thinking about selling in the near future and want to understand the tax impact.
Frequently Asked Questions
Can I use the Section 121 exclusion if I rent out part of my house?
You can use the exclusion on the part of the house you lived in, but not on the part you rented out. If you rented out a room or a basement apartment, you must split the gain between the owner-occupied part and the rental part. Only the owner-occupied part qualifies for the exclusion. You will also owe depreciation recapture tax on the rental part.
What if I inherited the house from a parent?
If you inherited the house, your basis is stepped up to the fair market value on the date of death, not what your parent paid. This means if you sell shortly after inheriting, you may owe little or no capital gains tax. However, you must still meet the two-year ownership and use test to use the Section 121 exclusion. The time your parent owned the house does not count toward your two years.
Do I have to report the sale to the IRS even if I owe no tax?
Yes. You must file Form 8949 and Schedule D with your tax return for the year of the sale, even if you owe no tax because of the Section 121 exclusion. This tells the IRS that you claimed the exclusion and how you calculated your gain. Failure to report can trigger an audit.
Can I avoid capital gains tax by gifting the house to my children instead of selling?
If you gift the house, you avoid capital gains tax at the time of the gift. However, your children will inherit your basis, not a stepped-up basis. If they later sell, they will owe tax on the gain from when you bought it, not from when you gave it to them. If you sell and they inherit the proceeds, they get a stepped-up basis and owe no tax on the gain. Gifting is rarely better for tax purposes.
What if I sold the house before 2018 and did not know about the Section 121 exclusion?
You may be able to file an amended return for up to three years back. Contact a tax professional or the IRS to discuss whether you can amend and claim the exclusion retroactively. You will need your original sale documents and proof that you met the ownership and use test.