The Capital Gains Tax Exclusion When Selling Your Primary Residence

You can often sell your primary residence tax-free

Smiling woman writing on a large packing box

Tom Grill / Getty Images

You probably won't take a big capital gains tax hit if you sell your primary residence, thanks to the Taxpayer Relief Act of 1997. Taxpayers can exclude up to $250,000 in capital gains on the sale of their primary residences, or up to $500,000 if they're married and file a joint return, as of tax year 2020.

This special tax treatment is known as the "Section 121 exclusion."

How Does the Exclusion Work?

The Internal Revenue Service requires that to qualify for the exclusion, a homeowner must have owned the property for two of the last five years and lived in it as his main residence for at least two of the last five years preceding the date of sale.

As an example, let's say that you've owned and lived in your house for three years. You sell the house for $250,000, and your basis in the property is $205,000. You'll have a capital gain of $45,000.

Capital gains tax is calculated on the difference between the sales price and your basis in the property, which the IRS defines as its purchase price plus the cost of any capital improvements you've made to it.

You should not have to pay any federal capital gains tax, because your gain of $45,000—the difference between the purchase price or tax basis and the sale proceeds—is significantly less than the $250,000 exclusion you're entitled to if you're a single taxpayer. Your capital gain is therefore completely income tax-free.

Other Rules and Loopholes

The two-year ownership and residency periods don't have to be simultaneous. You might have purchased your home in 2018 after living there as a tenant for two years. You then might have purchased the residence and sold it in 2020.

Since you've owned it for two years, 2018 through 2020 (assuming you didn't sell before your two-year anniversary), you've met the ownership test. And you've lived in the home for four of the last five years as well, counting the time you were a tenant prior to purchasing it.

The rules state that both the residency term and the ownership term must occur within the last five years immediately preceding the sale of the home, but they don't have to be concurrent.

The Section 121 exclusion isn’t a one-shot deal. You can effectively sell your residence every two years without owing any capital gains tax on the proceeds, as long as you live there and own it during that time. You just can't claim the exclusion any more often than once every two years if you're going to meet these rules.

Two other factors can disqualify you, but they're relatively rare. You can't have acquired the property through a like-kind 1031 exchange in the last five years, and you can't be subject to the expatriate tax.

Partial Exclusions

Some taxpayers who sell their residences before meeting the two-out-of-five-years rules might still qualify for a partial exclusion of their gains. The tax code allows taxpayers to exclude a portion of their capital gains if they must sell to relocate for work, because of health issues, or due to other unforeseen circumstances.

The resulting sale of your home is work-related and not something you voluntarily elected to do if your employer transfers you to a position out of town after you’ve lived in your home for just one year. You won’t have to take a big tax hit, but you can’t use the entire $250,000 exclusion.

You lived in your home for 50% of the required time if you were in residence for one year. You would therefore multiply 50% by $250,000. The result is that you can exclude a profit of up to $125,000. You would only pay capital gains on any proceeds exceeding this amount.

Your new work location must be at least 50 miles more distant from your home than your old one was, to qualify for a partial exclusion under these rules.

Members of the military are completely exempt from the two-year rule for up to 10 years if they’re required to move due to service commitments. They must be assigned to a duty station that's at least 50 miles from their home.

Reporting the Gain

You must still report the gain on your tax return, even if it's excluded from your income, if you receive a Form 1099-S, "Proceeds from Real Estate Transactions." The IRS receives a copy of this informational return, too, so you have to let it know that you qualify to exclude the capital gain. You can do this by reporting the income and claiming the exclusion on your tax return.

Unfortunately, capital losses on the sale of personal property—including your home—aren't deductible for tax purposes. You won't have to pay any additional tax if you suffer a loss on the sale of your property, but you won't get a tax break for it, either.

Frequently Asked Questions (FAQs)

How much is the capital gains tax on the sale of a primary residence?

Capital gains on assets that are held one year or less are taxed at your normal income tax rate. If you hold the asset for more than a year—which you would have to do to qualify for the primary residence exclusion—then capital gains are taxed at either 0%, 15%, or 20%. A single person who earns less than $40,400 in a year ($80,800 for married couples filing jointly) qualifies for the 0% rate. A single person who earns less than $445,850 in a year ($501,600 for married couples filing jointly) qualifies for the 15% rate.

How long can you rent out a house if you want to claim the primary residence capital gains exemption?

There is no limit on how long you can rent out a house, but the two-year primary residence requirement must be met within the five years before the sale. That means you can only rent out the home for three of the five years before the sale. Before that five-year window, there aren't any restrictions.