Capital gains exclusion: How to save on taxes when you sell your home

Selling a home is a difficult process. You need to find a broker or sell it yourself, find a buyer who is the right fit, endure the home inspection, negotiate the cost, pay commission, and finally close on the sale and move out. But your worries aren’t over yet. At the end of the year, you’ll likely receive a Form 1099-S showing how much money you received from the sale of your home. Depending on how the numbers work out, you might have tax consequences.
The taxing of property follows the “recovery of capital doctrine,” which means that you are able to recover part of your investment in the property before recognizing a capital gain or loss. Plus, the IRS excludes a portion of gains on the sale of your primary residence in certain situations.
Key Points
- The initial basis in your home plus capital improvements equals your adjusted basis.
- The gain or loss on the sale of your home is the selling price, minus commissions and other selling expenses, minus your adjusted basis.
- Certain tax rules may allow you to exclude up to $500,000 of the gain.
In order to figure out the tax ramifications of your home sale, you’ll need to know your home’s adjusted basis, if your home sale qualifies for the IRS exclusion of some of the gain, and how to report it on your tax return.
Note that different rules apply for certain property types and transactions, including like-kind (1031) exchanges, remainder interests, vacant land, destroyed or condemned property, property used for business, and rental property.
Figuring the initial property basis
Things you own for personal or investment reasons are capital assets. Assets have a basis, meaning the cost that you paid for them. In the case of a home, some additional fees and costs associated with the original purchase are included in your basis.
According to IRS Publication 523, the following fees and closing costs are allowed to be included in your basis:
- Abstract fees
- Charges for installing utility services
- Legal fees such as title search and preparing the contract and deed
- Recording fees
- Survey fees
- Transfer or stamp taxes
- Title insurance
Example: Linda and Greg purchased a house in the state of Illinois in 1991 for $125,000 plus $5,800 in fees and closing costs. Their initial basis in their home is $130,800 ($125,000 + $5,800).
Did you build your house?
In addition to closing costs, your basis in a house you built includes the cost of the land, labor and materials, amounts paid to contractors and architects, building permits, utility meter and connection charges, and legal fees.
Home improvements adjust the property basis
During the course of your home ownership, you might improve it. Maintenance costs, such as mowing the lawn, annual furnace inspections, painting, or replacing or fixing broken, leaking, or rotted parts of the home are not considered improvements. Improvements that increase the basis are ones that will increase the value of the home and transfer to a new owner when you sell the home. They include:
- Additions such as bedrooms, bathrooms, a deck, a garage, a porch, a patio
- Improvements to home systems such as HVAC, wiring, security systems, filtration systems
- Outdoor improvements such as landscaping, a fence, walkways and driveways, a swimming pool, a retaining wall, windows or doors, a new roof, new siding
- Indoor improvements such as a water heater, septic system, built-in appliances, kitchen or bath modernization, flooring or carpeting, a fireplace, or insulation (but if you later replace those items, you can’t include the old cost again in your basis)
Note that if you received a tax credit for any energy-related improvements or received insurance money from improvements made due to a claim, you must subtract those credits or subsidies from your adjusted basis.
Example: Linda and Greg made some improvements as they lived in their house. An addition in 1994 cost $55,000; a new kitchen in 1995 cost $35,000; a new roof in 2010 cost $12,000. They painted the house in 2012 for $3,500 and added a patio in 2015 for $9,000. Their adjusted basis in 2015 is $241,800 ($130,800 initial basis + $55,000 + $35,000 + $12,000 + $9,000). The painting cost is considered maintenance and thus did not increase their basis.
A home you own but didn’t purchase
Your property basis is calculated differently if you acquired it by a means other than purchasing it.
If you inherited your home
Your basis is the fair market value of the property on the date of the decedent’s death. An “alternate valuation date” after the date of death may be selected by the estate if it is not practical to have an evaluation made on the exact date. Note that if you inherited the home in the year 2010 specifically, different rules apply.
If you are a surviving spouse
If you jointly owned the home, you keep half of the adjusted basis of the home on the date your spouse died, plus half of the fair market value of the home on that date. If you live in a community property state (Arizona, California, Idaho, Louisiana, Nevada, New Mexico, Texas, Washington, or Wisconsin), the basis of the surviving spouse is calculated as the fair market value on the date of death or alternate valuation date (“stepped-up basis,” in tax accounting lingo).
Example: Greg passed away in 2020 when Greg and Linda’s adjusted basis in the home was $241,800. The home’s fair market value at that time was $500,000. The home was in Illinois (not a community property state), so Linda’s new basis is $370,900 ($241,800/2 = $120,900 added to $500,000/2 = $250,000).
If you received your home as a gift
You’ll need to keep track of your donor’s adjusted basis, the fair market value on the date of the gift, and any gift tax the donor paid. If the donor’s adjusted basis is less than the fair market value on the date of the gift, use that plus any gift tax as your basis. If the donor’s adjusted basis is more than fair market value, and you later sell the property for less than that adjusted basis, you’ll instead use the fair market value as your basis.
If you received your home in a divorce
If it was originally acquired after July 18, 1984, your basis will be the adjusted basis at the time of the divorce in most cases. If it was acquired before that time, your basis will be the fair market value on the divorce date.
In other cases
There are different rules for homes that you received through a trade of another home or property, or if your home was foreclosed, repossessed, abandoned, destroyed, or condemned. See IRS Publication 523 as a starting point.
Did you use your property as a business or did you rent it out?
Different rules apply when you sell your house if you had a home business or if you rented it to someone else. See IRS Publication 523 for details.
Calculate your gain or loss on the sale of your home
After you sell your home, take your selling price minus selling expenses such as commissions, advertising fees, or legal fees to get the amount realized. Then deduct your adjusted basis. If the number is positive, you have a gain; if the number is negative, you lost money on the sale of your home.
Example: Linda sold her house in 2021 for $575,000. After paying a commission of $25,000, her amount realized was $550,000. Since her basis was $370,900 (see previous example), she had a gain of $179,100.
Exclusion of home sale gain
Review four criteria to figure out if you can exclude some of your home sale’s gain from your taxes:
- Automatic disqualification. If you acquired your home through a like-kind (1031) exchange during the past five years, or if you are subject to expatriate tax, you are automatically disqualified from the exclusion.
- Ownership. You must have owned your home for at least two years (24 total months) out of the last five years before the date you sold your home. If you are married and filing jointly, only one spouse has to meet this ownership requirement.
- Residence. You and your spouse must use the home as your residence for 730 days (24 total months) over the past five years; the time does not have to be spent in a block. Short absences (such as vacations) count as time lived in your home, as does time spent in a nursing home or hospital under most scenarios.
- Look-back period. You are allowed to take the exclusion only once during a two-year period, so look back two years and make sure you didn’t sell a different home and take the exclusion.
Do you own more than one home?
You can only take a home gain exclusion on the sale of a home that is your primary residence. You can only have one primary residence at a time, even if you own more than one home. Your primary residence is the one reported on your tax returns, driver’s license, car registration, voter registration card, and so on. It is near where you work, bank, and spend most of your time.
There are special residence and ownership rules if you are separated, divorced, or a surviving spouse. See IRS Publication 523. Note that if you transferred your home to an ex-spouse as part of a divorce settlement, you have nothing to report and no gain or loss on that transaction.
Partial eligibility
If you don’t meet the eligibility test, the IRS says you may still qualify for a partial exclusion of gain if you moved because of an unforeseeable event or a special work-related or health-related situation. See IRS Publication 523 for more details.
Gain exclusion calculation
The maximum exclusion is $500,000 for those married and filing jointly, and surviving spouses under certain situations. Those single and married filing separately have a maximum exclusion of $250,000.
| Tax status | Eligibility | Maximum exclusion |
|---|---|---|
| Married filing jointly | Residence and look-back for both spouses, ownership for at least one spouse | $500,000 |
| Single or married filing separately | Residence, ownership, and look-back | $250,000 |
| Surviving spouse | Residence, ownership, and look-back, plus you haven’t remarried at the time of the sale and you sell your home within two years of the death of your spouse | $500,000 |
Example: Linda was not remarried when she sold her home in 2021, which was within two years of Greg’s death. Since her maximum exclusion is $500,000 and her gain was $179,100, she is able to exclude her entire gain from her taxable income.
The bottom line
You will need to report the sale of your home on your tax return:
- If you have taxable gain above any exclusions.
- If you choose to report the gain because you plan to sell another primary residence in the next two years and will meet the exclusion requirements.
- If you receive a Form 1099-S, even without taxable gains to report. Form 8949 will help you report the home sale, and your gain will be taxed as a capital gain through Schedule D.
Always keep documents pertaining to purchasing, inheriting, and selling property. Also, make sure that you keep a list and backup documentation for all capital improvements made to your home. In addition to making your home appealing for your own use, and that of a future owner, the IRS encourages you to make improvements to your primary residence through its gain exclusion policy.
References
- IRS Publication 523 Selling Your Home | irs.gov



