The primary way to avoid capital gains tax on a home sale is the Section 121 exclusion, which lets you exclude up to $250,000 of gain if you're single or $500,000 if you're married filing jointly — provided you meet the ownership and use tests.
You must have owned the home for at least two of the five years before the sale, and lived in it as your primary residence for at least two of those five years. The two years do not have to be consecutive. If you meet these conditions, you owe no federal tax on the excluded amount, even if your gain exceeds the limit.
This exclusion is available once every two years per person. If you sold another home and used the exclusion within the past two years, you cannot use it again until that two-year window closes. State taxes may still apply depending on where you live, but the federal exclusion eliminates the largest tax burden for most homeowners.
Key Takeaways
- The Section 121 exclusion eliminates federal tax on up to $250,000 (single) or $500,000 (married) of home sale gain if you owned and lived in the home for two of the past five years.
- You can use this exclusion once every two years, so selling two homes in quick succession means the second sale may be taxable.
- If your gain exceeds the exclusion limit, you owe long-term capital gains tax on the remainder, which is lower than ordinary income tax rates.
- Keeping records of home improvements, purchase price, and sale expenses reduces your taxable gain by increasing your cost basis.
- State and local taxes on home sales vary widely and are not covered by the federal exclusion.
How the Section 121 exclusion works in practice
The exclusion applies to the gain on your home, not the sale price. Your gain is the sale price minus your adjusted cost basis. Your cost basis starts with what you paid for the home, plus the cost of major improvements like a new roof, kitchen renovation, or addition. It does not include routine maintenance like painting or repairs.
If you bought a home for $300,000, spent $50,000 on improvements, and sold it for $600,000, your gain is $250,000. As a single filer, you exclude the entire $250,000 under Section 121, so you owe no federal capital gains tax. If you were married filing jointly, the same sale would still be fully excluded because the gain is under $500,000.
If the same home sold for $700,000 instead, your gain would be $350,000. A single filer would owe tax on $100,000 ($350,000 gain minus $250,000 exclusion). A married couple would owe nothing because $350,000 is under their $500,000 limit. The tax rate on the taxable portion depends on your income level and filing status, but long-term capital gains rates are 0%, 15%, or 20% — lower than ordinary income tax brackets.
What counts as ownership and use for the two-year test
You do not have to own and live in the home continuously for two years. The IRS allows gaps. If you owned the home for five years but lived in it for only two of those years, you still may have access to. The two years of use must fall within the five-year window before the sale.
If you moved out three years ago but still own the home and sell it today, you fail the test because you have not lived there within the past two years. However, if you moved out two years ago and sell today, you pass because the two-year use requirement was met within the five-year window.
Temporary absences count as use. If you rented out the home for six months while you were working overseas, that time still counts toward your two years of use as long as you owned the home and it remained your primary residence before and after the absence. The IRS recognizes that life circumstances change.
Increasing your cost basis to reduce taxable gain
Every dollar you can add to your cost basis reduces your taxable gain dollar-for-dollar. Keep records of the purchase price, closing costs, and all home improvements. Closing costs like title insurance, appraisal fees, and attorney fees are part of your basis. So are capital improvements — work that adds value, prolongs the home's life, or adapts it to new uses.
A new roof, kitchen remodel, deck, or HVAC system counts. Painting, landscaping, and repairs do not, even if they cost thousands. The line is whether the work adds value or merely maintains the home's current condition. If you are unsure, keep the receipt and document what was done.
If you made improvements over many years, gather the invoices and receipts before you sell. Some homeowners discover old receipts in files or email and add thousands to their basis. If you cannot find documentation, you cannot claim the improvement, so organize records as you go.
What happens if your gain exceeds the exclusion limit
If you are single and your gain exceeds $250,000, or married and your gain exceeds $500,000, you owe federal long-term capital gains tax on the excess. Long-term rates are 0%, 15%, or 20% depending on your total taxable income for the year, which is significantly lower than ordinary income tax rates.
Your capital gains tax rate depends on your filing status and income. For 2024, the 15% rate applies to single filers with taxable income between roughly $47,000 and $518,000, and married couples filing jointly between roughly $94,000 and $583,000. These thresholds change annually. The 20% rate applies to higher incomes, and the 0% rate applies to lower incomes.
You report the sale on Form 8949 (Sales of Capital Assets) and Schedule D (Capital Gains and Losses), which you attach to your tax return. If you used the Section 121 exclusion, you still file these forms but report the excluded gain as zero. Your tax preparer or software will handle this calculation if you provide the purchase price, sale price, and improvement costs.
Special situations that limit or eliminate the exclusion
If you sold another home within the past two years and used the Section 121 exclusion, you cannot use it again until two years have passed from that prior sale. This rule prevents people from selling multiple homes in quick succession and excluding gain from each one.
If you did not meet the two-year ownership or use test because of a job change, health condition, or unforeseen circumstance, you may be able to claim a reduced exclusion. You would exclude a fraction of the $250,000 or $500,000 based on how long you actually owned and used the home. For example, if you owned and used the home for only one year before selling due to a job relocation, you might exclude half the normal amount. You must file Form 8801 to claim this reduced exclusion and provide documentation of the circumstance.
If you inherited the home, the rules are different. You receive a "stepped-up basis" equal to the home's fair market value on the date of death, not the original purchase price. This means your gain is calculated from that stepped-up basis, which often eliminates or greatly reduces any taxable gain when you sell.
State and local taxes on home sales
The federal Section 121 exclusion does not cover state or local capital gains taxes. Some states tax capital gains on home sales, while others do not. California, for example, taxes all capital gains at ordinary income rates with no home sale exclusion. New York taxes capital gains but offers no exclusion for primary residences. Other states like Texas, Florida, and Washington have no state capital gains tax at all.
A few states offer their own primary residence exclusions. Some states also impose transfer taxes or sales taxes on the transaction itself, separate from capital gains tax. These vary widely and depend on where you live and where the home is located. Check your state's tax authority website or speak with a tax preparer in your state to understand what you owe.
If you are moving from a high-tax state to a low-tax state, timing the sale around your move may affect your tax liability. This is complex and depends on your specific situation, so it is worth discussing with a tax professional before you list the home.
Frequently Asked Questions
Do I have to live in the home for two full years before I can use the exclusion?
No. You need two years of ownership and two years of use within the five-year window before the sale, but they do not have to be consecutive or overlap perfectly. You could own the home for five years, live in it for two of those years, move out, and still use the exclusion when you sell.
What if I inherited the home from a parent?
You receive a stepped-up basis equal to the home's value on the date of death. Your gain is calculated from that new basis, not the original purchase price. You still need to meet the two-year ownership and use test to use the Section 121 exclusion, but the stepped-up basis often eliminates most or all of the gain.
Can I use the exclusion if I rent out part of my home?
If you rented out part of the home while you lived there, the exclusion applies only to the portion you used as your primary residence. You would owe capital gains tax on the gain attributable to the rental portion. If you rented out the entire home for the last two years before selling, you do not may have access to for the exclusion at all.
What if I sold a home two years ago and used the exclusion — can I use it again now?
Yes, as long as two years have passed since the prior sale. The exclusion is available once every two years per person. If you sold on January 15, 2023, you can use the exclusion again on January 15, 2025, or later.
Do I need to report the sale to the IRS even if I use the exclusion and owe no tax?
Yes. You must file Form 8949 and Schedule D with your tax return reporting the sale, the gain, and the Section 121 exclusion, even if the result is zero tax owed. Failure to report the sale can trigger an audit or penalty.