Selling your home is one of the most significant financial transactions you will ever make, and understanding the capital gains tax on a home sale is essential before you put a “For Sale” sign in the yard. Many homeowners focus on the listing price, staging, and closing logistics, yet the tax consequences of selling a home can meaningfully affect your net proceeds. Whether you are selling a principal residence, a second home, or a property with mixed personal and business use, the rules differ in important ways.
This guide answers the question most sellers care about: how much of your gain will the IRS take, and what can you legally do to keep more of it. Below is a detailed look at how home sale taxes work, what exclusions may apply, and how to plan ahead so you keep more of your profit. For sellers with rental or mixed-use holdings, coordinating these moves with a CPA who handles real estate clients can prevent costly surprises at closing.
How the Capital Gains Exclusion Works for Your Principal Residence
The single most valuable tax break available to home sellers is the Section 121 exclusion. Under this provision, you can exclude up to $250,000 of gain from the sale of your principal residence if you file as a single taxpayer, or up to $500,000 if you file a joint return. The full rules appear in IRS Topic No. 701 and IRS Publication 523. Gain that qualifies for the exclusion is also exempt from the 3.8% net investment income tax (NIIT), which can add meaningful savings for higher-income sellers.
To qualify, you must meet the ownership and use tests. You need to have owned the home and used it as your primary residence for at least two of the five years preceding the sale. These two years do not need to be consecutive, which gives some flexibility for homeowners who moved temporarily for work or other reasons.
Gain attributable to periods of “nonqualified use,” for example years when the home was rented out before you moved in, is generally not eligible for the exclusion. The IRS looks at the ratio of nonqualified use to total ownership when determining how much of the gain qualifies. Sellers who use the exclusion more than once should also confirm the two-year look-back rule, which generally limits you to one Section 121 exclusion every two years.
Calculating Your Taxable Gain Accurately
Your taxable gain is not simply the difference between your purchase price and your sale price. Capital gains taxes on selling a house are calculated based on your adjusted tax basis, which accounts for your original purchase cost plus the value of qualifying improvements you made over the years, minus any casualty losses or depreciation you claimed for business use.
Qualifying improvements include major projects that add value to the home or extend its useful life, such as kitchen renovations, roof replacements, or adding a bathroom. Routine maintenance and repairs, such as painting or fixing a leaky faucet, do not count toward your basis.
Keeping thorough records throughout your years of ownership is critical. Save receipts, contracts, and invoices for all significant home improvements. These records directly reduce your taxable gain when you sell, and without them, you may end up paying more capital gains tax on your home sale than necessary.
Selling House Tax Implications When You Have a Loss
Not every home sale results in a profit, and the tax treatment of a loss depends on how the property was used. A loss on the sale of your principal residence is generally not deductible. The IRS treats your primary home as a personal-use asset, so any decline in value is considered a personal loss that cannot offset other income.
There is an exception for mixed-use properties. If you used part of your home exclusively for business, such as a dedicated home office, or rented out a portion of the property, the loss allocable to that business or rental portion may be deductible. The key word is “exclusively.” Occasional use of a spare bedroom as a home office typically does not qualify.
If your home has lost value, consult a tax professional to determine whether any portion of the loss can be claimed. Proper documentation of the business-use percentage is essential to support the deduction, and our tax advisory team can help you substantiate that allocation.
Tax Rules for Selling a Second Home or Investment Property
Selling a second home triggers different tax considerations than selling your primary residence. The home sale capital gains exclusion under Section 121 does not apply to vacation homes, second residences, or investment properties. That means the full gain on the sale is potentially taxable at capital gains rates.
If the second home qualifies as a rental property, you may have additional options. You can potentially defer the tax on your gain by using a Section 1031 like-kind exchange, which allows you to roll the proceeds into another qualifying investment property without recognizing the gain immediately. The IRS sets strict deadlines for these exchanges, as outlined in its like-kind exchange guidance. Alternatively, you may be able to structure the sale as an installment sale, spreading the gain over multiple tax years to manage your tax bracket.
If you sell a rental or investment property at a loss, that loss is generally deductible against other income, unlike losses on a personal residence. You may also need to account for depreciation recapture, which is taxed at a rate of up to 25% on the portion of gain attributable to depreciation you previously claimed.
How to Avoid Capital Gains Tax on the Sale of a Home
There is no magic trick to eliminate capital gains tax entirely, but there are legitimate strategies that can reduce or defer your tax liability. The Section 121 exclusion is the most straightforward: if you meet the ownership and use tests, up to $250,000 (or $500,000 for joint filers) of your gain is simply tax-free.
Beyond the exclusion, consider these approaches:
- Maximize your cost basis. Track every qualifying improvement over the years so your adjusted basis is as high as possible, reducing your taxable gain.
- Time the sale carefully. If you are close to meeting the two-year ownership and use requirement, waiting a few months can mean the difference between a fully taxable gain and a tax-free one.
- Use a 1031 exchange for investment properties. If you are selling a rental or investment property, a properly structured like-kind exchange can defer the entire gain.
- Offset gains with losses. Capital losses from other investments can offset capital gains from a home sale, reducing your overall tax bill.
Planning ahead is the most effective way to minimize your tax exposure. Speaking with a CPA or tax advisor before listing your home gives you time to implement these strategies. If your sale involves a business interest, multiple properties, or a 1031 exchange, our transaction advisory services can model the after-tax outcome before you sign anything.
What Homeowners Over 65 Should Know About Capital Gains
A common question among older homeowners is whether seniors receive a special one-time capital gains exemption. While there was a one-time exclusion for sellers over 55 under prior tax law, that provision was replaced in 1997 by the current Section 121 exclusion, which is available to sellers of any age who meet the ownership and use tests. There is no additional age-based exemption in the current tax code.
Homeowners over 65 may still benefit from other tax planning considerations. If your income is lower in retirement, your capital gains tax rate may be lower, or even zero if your taxable income falls within the 0% long-term capital gains bracket. Coordinating the timing of your home sale with your overall retirement income can yield significant tax savings.
Frequently Asked Questions
Do I pay taxes when I sell my house?
You may owe capital gains tax if you sell your home for more than your adjusted tax basis. However, if the home is your principal residence and you meet the ownership and use requirements, you can exclude up to $250,000 of gain ($500,000 for joint filers) from taxation under Section 121. If your gain falls within the exclusion amount, you owe no federal tax on the sale.
How do I avoid capital gains tax on the sale of a home?
The primary way to avoid capital gains tax is to qualify for the Section 121 exclusion by owning and living in the home as your principal residence for at least two of the past five years. You can also reduce your taxable gain by increasing your cost basis through documented home improvements. For investment properties, a 1031 like-kind exchange can defer the tax entirely.
What is the Section 121 exclusion for home sales?
The Section 121 exclusion allows homeowners to exclude up to $250,000 of capital gain ($500,000 for married couples filing jointly) when selling a principal residence. To qualify, you must have owned and used the home as your primary residence for at least two of the five years before the sale. Gain excluded under Section 121 is also exempt from the 3.8% net investment income tax.
How is capital gains tax calculated on a home sale?
Capital gains tax is calculated on the difference between your home’s sale price and your adjusted tax basis. Your basis starts with your original purchase price and increases with qualifying improvements such as renovations or additions. It decreases with any depreciation claimed. The resulting gain is taxed at long-term capital gains rates, which range from 0% to 20% depending on your income.
Do seniors get a one-time capital gains exemption?
There is no current one-time capital gains exemption specifically for seniors. The old “over 55” exclusion was replaced in 1997 by the Section 121 exclusion, which is available to homeowners of any age. However, seniors with lower retirement income may qualify for the 0% long-term capital gains rate, effectively paying no federal tax on their home sale gain.
What are the tax rules for selling a second home?
A second home or vacation property does not qualify for the Section 121 capital gains exclusion. The full gain is subject to capital gains tax. If the property was used as a rental, you may be able to defer the gain through a 1031 exchange or deduct a loss. Depreciation recapture tax of up to 25% may also apply to any depreciation you previously claimed on the property.




