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. Single 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, for the 2022 tax year.

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

Key Takeaways

  • You can exclude $250,000 or $500,000 of the capital gains you earn from a home sale, depending on your filing status and whether you meet certain criteria.
  • In general, you have to own the home and live in it for two of the past five years to qualify for the exclusion.
  • You can earn a partial exclusion if you experienced certain circumstances such as a job requiring you to move at least 50 miles away from your home.

How Does the Exclusion Work?

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

Suppose you've owned and lived in your house for three years. You sell it 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 $45,000 gain is significantly less than the $250,000 exclusion you're entitled to if you're a single taxpayer. Your capital gain is therefore tax-free.

Other Rules and Loopholes

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.


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.

Several other factors can disqualify you, but they're relatively rare. For example, 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 following examples could be eligible for a partial exclusion:

  • 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. 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, you can't deduct capital losses on the sale of personal property—including your home. Only losses on property used for a trade or business are deductible.

Frequently Asked Questions (FAQs)

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

If you don't meet the two-out-of-five-years requirement for the home sale exclusion, you'll pay capital gains taxes on the difference between the sale price and your basis. If you do meet the requirements for the exclusion, you'll pay capital gains taxes on capital gains that exceed the exclusion amount. The capital gains tax rate on the gain on sale of a home you've owned for more than a year can range from 0% to 20%, but most taxpayers pay 15% based on their taxable income. If you've owned the home for one year or less, you pay ordinary income tax rates that range up to 37%.

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 that, in general, you can only rent out the home for three of the five years before the sale.

Was this page helpful?
The Balance uses only high-quality sources, including peer-reviewed studies, to support the facts within our articles. Read our editorial process to learn more about how we fact-check and keep our content accurate, reliable, and trustworthy.
  1. IRS. "Topic No. 409 Capital Gains and Losses."

  2. IRS. "Topic No. 701 Sale of Your Home."

  3. IRS. "Topic No. 703 Basis of Assets."

  4. IRS. "Publication 523 (2021), Selling Your Home."

  5. IRS. "Capital Gains, Losses, and Sale of Home."

Related Articles