Capital Gains Tax on Home Sales

Do you have to pay capital gains tax on a home sale? That depends. You could owe capital gains tax if you sell a home that has appreciated in value because it is a capital asset. However, thanks to the Taxpayer Relief Act of 1997, most homeowners are exempt from needing to pay it.

If you are single, you will pay no capital gains tax on the first $250,000 of profit (excess over cost basis). Married couples enjoy a $500,000 exemption. However, there are some restrictions. Learn the details below, including the records you should keep while you own a home to help offset any taxes that could be due.

Key Takeaways

  • You can sell your primary residence and be exempt from capital gains taxes on the first $250,000 if you are single and $500,000 if married filing jointly.
  • This exemption is only allowable once every two years.
  • You can add your cost basis and costs of any improvements that you made to the home to the $250,000 if single or $500,000 if married filing jointly.
1:02

Is It True That You Can Sell Your Home And Not Pay Capital Gains Tax?

How Much Is Capital Gains Tax on Real Estate?

To be exempt from capital gains tax on the sale of your home, the home must be considered your principal residence based on Internal Revenue Service (IRS) rules. These rules state that you must have occupied the residence for at least 24 months of the last five years.

If you buy a home and a dramatic rise in value causes you to sell it a year later, you would be required to pay full capital gains tax—short-term or long-term on the house, depending on exactly how long you owned it.

However, if you’ve owned your home for at least two years and meet the principal residence rules, you may be able to exclude some or all of the long-term capital gains tax that would be owed on the profit. Single people can exclude up to $250,000 of the gain, and married people filing a joint return can exclude up to $500,000 of the gain.

Short-term capital gains are taxed as ordinary income, with rates as high as 37% for high-income earners. Long-term capital gains tax rates are 0%, 15%, 20%, or 28% for small business stock and collectibles, with rates applied according to income and tax-filing status.

This rule even allows you to convert a rental property into a principal residence because the two-year residency requirement does not need to be fulfilled in consecutive years, just cumulative months.

The 2-in-5-Year Rule

For taxpayers with more than one home, a key point is determining which is the principal residence. The IRS allows the exclusion only on one’s principal residence, but there is some leeway for which home qualifies. The two-in-five-year rule comes into play. Simply put, this means that during the previous five years, if you lived in a home for a total of two years, or 730 days, that can qualify as your primary residence. The 24 months do not have to be in a particular block of time.

One caveat: For married taxpayers filing jointly, each spouse must meet the rule. A couple who married recently would not qualify for the $500,000 exclusion even if one of them had owned the property for many years.

How the Capital Gains Tax Works with Homes

Suppose you purchase a new condo for $300,000. You live in it for the first year, rent the home for the next three years, and when the tenants move out, you move in for another year. After five years, you sell the condo for $450,000. No capital gains tax is due because the profit ($450,000 - $300,000 = $150,000) does not exceed the exclusion amount. Consider an alternative ending in which home values in your area increased exponentially.

In this scenario, you sell the condo for $600,000. Capital gains tax is due on $50,000 ($300,000 profit - $250,000 IRS exclusion). If your income falls in the $44,626–$492,300 range, for 2023, your tax rate is 15%. If you have capital losses elsewhere, you can offset the capital gains from the sale of the house with those losses, and up to $3,000 of those losses from other taxable income.

2023 Long-term Capital Gains Rates (for Taxes Due in 2024)
Filing Status 0% Tax Rate 15% Tax Rate 20% Tax Rate
Single < $44,625 $44,626 to $492,300 > $492,300
Married filing jointly < $89,250 $89,251 to $553,850 > $553,850
Married filing separately < $44,625 $44,625 to $276,900 > $276,900
Head of household < $59,750 $59,750 to $523,050 > $523,050
Applicable to the Sale of a Principal Residence

Requirements and Restrictions

If you meet the eligibility requirements of the IRS, you’ll be able to sell the home free of capital gains tax. However, there are exceptions to the eligibility requirements, which are outlined on the IRS website.

The main major restriction is that you can only benefit from this exemption once every two years. Therefore, if you have two homes and lived in each for at least two of the last five years, you won’t be able to sell both of them tax free until more than two years have passed since you sold the first one.

The Taxpayer Relief Act of 1997 significantly changed the implications of home sales in a beneficial way for homeowners. Before the act, sellers had to roll the full value of a home sale into another home within two years to avoid paying capital gains tax. However, this is no longer the case, and the proceeds of the sale can be used in any way that the seller sees fit.

When Is a Home Sale Fully Taxable?

Not everyone can take advantage of the capital gains exclusions. Gains from a home sale are fully taxable when:

  • The home is not the seller’s principal residence.
  • The property was acquired through a 1031 exchange (more on that below) within five years.
  • The seller is subject to expatriate taxes.
  • The property was not owned and used as the seller’s principal residence for at least two of the last five years prior to the sale (some exceptions apply).
  • The seller sold another home within two years from the date of the sale and used the capital gains exclusion for that sale.

Example of Capital Gains Tax on a Home Sale

Consider the following example: Susan and Robert, a married couple, purchased a home for $500,000 in 2015. Their neighborhood experienced tremendous growth, and home values increased significantly. Seeing an opportunity to reap the rewards of this surge in home prices, they sold their home in 2022 for $1.2 million. The capital gains from the sale were $700,000.

As a married couple filing jointly, they were able to exclude $500,000 of the capital gains, leaving $200,000 subject to capital gains tax. Their combined income places them in the 20% tax bracket. Therefore, their capital gains tax was $40,000.

Capital Gains Tax on Investment Property

Most commonly, real estate is categorized as investment or rental property or as a principal residence. An owner’s principal residence is the real estate used as the primary location in which they live. But what if the home you are selling is an investment property, rather than your principal residence? An investment or rental property is real estate purchased or repurposed to generate income or a profit to the owner(s) or investor(s).

Being classified as an investment property, rather than as a second home, affects how it’s taxed and which tax deductions, such as mortgage interest deductions, can be claimed. Under the Tax Cuts and Jobs Act (TCJA) of 2017, up to $750,000 of mortgage interest on a principal residence or vacation home can be deducted. However, if a property is solely used as an investment property, it does not qualify for the capital gains exclusion.

Deferrals of capital gains tax are allowed for investment properties under the 1031 exchange if the proceeds from the sale are used to purchase a like-kind investment. And capital losses incurred in the tax year can be used to offset capital gains from the sale of investment properties. So, although not afforded the capital gains exclusion, there are ways to reduce or eliminate taxes on capital gains for investment properties.

Rental Property vs. Vacation Home

Rental properties are real estate rented to others to generate income or profits. A vacation home is real estate used recreationally and not considered the principal residence. It is used for short-term stays, primarily for vacations.

Homeowners often convert their vacation homes to rental properties when they are not using them. The income generated from the rental can cover the mortgage and other maintenance expenses. However, there are a few things to keep in mind. If the vacation home is rented out for fewer than 15 days, the income is not reportable. If the vacation home is used by the homeowner for fewer than two weeks in a year and then rented out for the remainder, it is considered an investment property.

Homeowners can take advantage of the capital gains tax exclusion when selling a vacation home if they meet the IRS ownership and use rules. But a second home will generally not qualify for a 1031 exchange (see below).

How to Avoid Capital Gains Tax on Home Sales

Want to lower the tax bill on the sale of your home? There are ways to reduce what you owe or avoid taxes on the sale of your property. If you own and have lived in your home for two of the last five years, you can exclude up to $250,000 ($500,000 for married people filing jointly) of the gain from taxes.

Adjustments to the cost basis can also help reduce the gain. Your cost basis can be increased by including fees and expenses associated with the purchase of the home, home improvements, and additions. The resulting increase in the cost basis thereby reduces the capital gains.

Also, capital losses from other investments can be used to offset the capital gains from the sale of your home. Large losses can even be carried forward to subsequent tax years. Let’s explore other ways to reduce or avoid capital gains taxes on home sales.

Use 1031 Exchanges to Avoid Taxes

Homeowners can avoid paying taxes on the sale of a home by reinvesting the proceeds from the sale into a similar property through a 1031 exchange. This like-for-like exchange—named after Internal Revenue Code Section 1031—allows for the exchange of like property with no other consideration or like property including other considerations, such as cash. The 1031 exchange allows for the tax on the gain from the sale of a property to be deferred, rather than eliminated.

Owners—including corporations, individuals, trust, partnerships, and limited liability companies (LLCs)—of investment and business properties can take advantage of the 1031 exchange when exchanging business or investment properties for those of like kind.

The properties subject to the 1031 exchange must be for business or investment purposes, not for personal use. The party to the 1031 exchange must identify in writing replacement properties within 45 days from the sale and must complete the exchange for a property comparable to that in the notice within 180 days from the sale.

To prevent someone from taking advantage of the 1031 exchange and capital gains exclusion, the American Jobs Creation Act of 2004 stipulates that the exclusion applies if the exchanged property had been held for at least five years after the exchange.

An IRS memo explains how the sale of a second home could be shielded from the full capital gains tax, but the hurdles are high. It would have to be investment property exchanged for another investment property. The taxpayer has to have owned the property for two full years, it has to have been rented to someone for a fair rental rate for at least 14 days in each of the previous two years, and it cannot have been used for personal use for 14 days or 10% of the time it was otherwise rented, whichever is greater, for the previous 12 months.

Since executing a 1031 exchange can be a complex process, there are advantages to working with a reputable, full-service 1031 exchange company. Given their scale, these services generally cost less than attorneys who charge by the hour. A firm that has an established track record in working with these transactions can help you avoid costly missteps and ensure that your 1031 exchange meets the requirements of the tax code.

Convert Your Second Home into Your Principal Residence

Capital gains exclusions are attractive to many homeowners, so much so that they may try to maximize its use throughout their lifetime. Because gains on non-principal residences and rental properties do not have the same exclusions, people have sought for ways to reduce their capital gains tax on the sale of their properties. One way to accomplish this is to convert a second home or rental property to a principal residence.

A homeowner can make their second home into their principal residence for two years before selling and take advantage of the IRS capital gains tax exclusion. However, stipulations apply. Deductions for depreciation on gains earned prior to May 6, 1997, will not be considered in the exclusion.

According to the Housing Assistance Tax Act of 2008, a rental property converted to a primary residence can only have the capital gains exclusion during the term when the property was used as a principal residence. The capital gains are allocated to the entire period of ownership. While serving as a rental property, the allocated portion falls under non-qualifying use and is not eligible for the exclusion.

How Installment Sales Lower Taxes

Realizing a large profit at the sale of an investment is the dream. However, the corresponding tax on the sale may not be. For owners of rental properties and second homes, there is a way to reduce the tax impact. To reduce taxable income, the property owner might choose an installment sale option, in which part of the gain is deferred over time. A specific payment is generated over the term specified in the contract.

Each payment consists of principal, gain, and interest, with the principal representing the nontaxable cost basis and interest taxed as ordinary income. The fractional portion of the gain will result in a lower tax than the tax on a lump-sum return of gain. How long the property owner held the property will determine how it’s taxed: long-term or short-term capital gains.

How to Calculate the Cost Basis of a Home

The cost basis of a home is what you paid (your cost) for it. Included are the purchase price, certain expenses associated with the home purchase, improvement costs, certain legal fees, and more.

Example: In 2010, Rachel purchased her home for $400,000. She made no improvements and incurred no losses for the 12 years that she lived there. In 2022, she sold her home for $550,000. Her cost basis was $400,000, and her taxable gain was $150,000. She elected to exclude the capital gains and, as a result, owed no taxes.

What Is Adjusted Home Basis?

The cost basis of a home can change. Reductions in cost basis occur when you receive a return of your cost. For example, you purchased a house for $250,000 and later experienced a loss from a fire. Your home insurer issues a payment of $100,000, reducing your cost basis to $150,000 ($250,000 original cost basis - $100,000 insurance payment).

Improvements that are necessary to maintain the home with no added value, have a useful life of less than one year, or are no longer part of your home will not increase your cost basis.

Likewise, some events and activities can increase the cost basis. For example, you spend $15,000 to add a bathroom to your home. Your new cost basis will increase by the amount that you spent to improve your home.

Basis When Inheriting a Home

If you inherit a home, the cost basis is the fair market value (FMV) of the property when the original owner died. For example, say you are bequeathed a house for which the original owner paid $50,000. The home was valued at $400,000 at the time of the original owner’s death. Six months later, you sell the home for $500,000. The taxable gain is $100,000 ($500,000 sales price - $400,000 cost basis).

The FMV is determined on the date of the death of the grantor or on the alternate valuation date if the executor files an estate tax return and elects that method.

Reporting Home Sale Proceeds to the IRS

You must report the sale of a home if you received a Form 1099-S reporting the proceeds from the sale or if there is a non-excludable gain. Form 1099-S is an IRS tax form reporting the sale or exchange of real estate. This form is usually issued by the real estate agency, closing company, or mortgage lender. If you meet the IRS qualifications for not paying capital gains tax on the sale, inform your real estate professional by Feb. 15 following the year of the transaction.

The IRS details which transactions are not reportable:

  • If the sales price is $250,000 ($500,000 for married people) or less and the gain is fully excludable from gross income. The homeowner must also affirm that they meet the principal residence requirement. The real estate professional must receive certification that these attestations are true.
  • If the transferor is a corporation, a government or government sector, or an exempt volume transferor (someone who has or will sell 25 or more reportable real estate properties to 25 or more parties)
  • Non-sales, such as gifts
  • A transaction to satisfy a collateralized loan
  • If the total consideration for the transaction is $600 or less, which is called a de minimus transfer

Special Situations: Divorce and Military Personnel

Getting divorced or being transferred because you are military personnel can complicate a taxpayer’s ability to qualify for the use requirement for capital gains tax exclusions on home sales. Fortunately, there are considerations for these situations.

Divorce

In a divorce, the spouse granted ownership of a home can count the years when the home was owned by the former spouse to qualify for the use requirement. Also, if the grantee has ownership in the house, the use requirement can include the time that the former spouse spends living in the home until the date of sale.

Military Personnel and Certain Government Officials

Military personnel and certain government officials on official extended duty and their spouses can choose to defer the five-year requirement for up to 10 years while on duty. Essentially, as long as the military member occupies the home for two out of 15 years, they qualify for the capital gains exclusion (up to $250,000 for single taxpayers and up to $500,000 for married taxpayers filing jointly).

Can home sales be tax free?

Yes. Home sales can be tax free as long as the condition of the sale meets certain criteria:

  • The seller must have owned the home and used it as their principal residence for two out of the last five years (up to the date of closing). The two years do not have to be consecutive to qualify.
  • The seller must not have sold a home in the last two years and claimed the capital gains tax exclusion.
  • If the capital gains do not exceed the exclusion threshold ($250,000 for single people and $500,000 for married people filing jointly), the seller does not owe taxes on the sale of their house.

How do I avoid paying taxes when I sell my house?

There are several ways to avoid paying taxes on the sale of your house. Here are a few:

  • Offset your capital gains with capital losses. Capital losses from previous years can be carried forward to offset gains in future years.
  • Use the Internal Revenue Service (IRS) primary residence exclusion, if you qualify. For single taxpayers, you may exclude up to $250,000 of the capital gains, and for married taxpayers filing jointly, you may exclude up to $500,000 of the capital gains (certain restrictions apply).
  • If the home is a rental or investment property, use a 1031 exchange to roll the proceeds from the sale of that property into a like investment within 180 days.

How much tax do I pay when selling my house?

How much tax you pay is dependent on the amount of the gain from selling your house and on your tax bracket. If your profits do not exceed the exclusion amount and you meet the IRS guidelines for claiming the exclusion, you owe nothing. If your profits exceed the exclusion amount and you earn $44,625 to $492,300 (2023 rate), you will owe a 15% tax (based on the single filing status) on the profits.

Do I have to report the sale of my home to the IRS?

It is possible that you are not required to report the sale of your home if none of the following is true:

  • You have non-excludable, taxable gain from the sale of your home (less than $250,000 for single taxpayers and less than $500,000 for married taxpayers filing jointly).
  • You were issued a Form 1099-S, reporting proceeds from real estate transactions.
  • You want to report the gain as taxable, even if all or a portion falls within the exclusionary guidelines.

Do you pay capital gains taxes when you sell a second home?

Because the IRS allows exemptions from capital gains taxes only on a principal residence, it’s difficult to avoid capital gains taxes on the sale of a second home without converting that home to your principal residence. This involves conforming to the two-in-five-year rule (you lived in it for a total of two of the past five years). Put simply, you can prove that you spent enough time in one home that it qualifies as your principal residence.

If one of the homes was primarily an investment, it’s not set up to be the exemption-eligible home.

The demarcation between investment property and vacation property goes like this: It’s investment property if the taxpayer has owned the property for two full years, it has been rented to someone for a fair rental rate for at least 14 days in each of the previous two years, and it cannot have been used for personal use for 14 days or 10% of the time that it was otherwise rented, whichever is greater, for the previous 12 months.

If you or your family use the home for more than two weeks a year, it’s likely to be considered personal property, not investment property. This makes it subject to taxes on capital gains, as would any other asset other than your principal residence.

Do you pay capital gains if you lose money on a home sale?

You can’t deduct the losses on a primary residence, nor can you treat it as a capital loss on your taxes. You may be able to do so, however, on investment property or rental property.

Keep in mind that gains from the sale of one asset can be offset by losses on other asset sales up to $3,000 or your total net loss, and such losses may be eligible for carryover in subsequent tax years.

If you sell below-market to a relative or friend, the transaction may subject the recipient to taxes on the difference, which the IRS may consider a gift. Also, remember that the recipient inherits your cost basis for purposes of determining any capital gains when they sell it, so the recipient should be aware of how much you paid for it, how much you spent on improvement, and costs of selling, if any.

Advisor Insight

Kimerly Polak Guerrero, CFP
Polero ICE Advisers, New York, N.Y.

In addition to the $250,000 (or $500,000 for a couple) exemption, you can also subtract your full cost basis in the property from the sales price. Your cost basis is calculated by starting with the price you paid for the home, and then adding purchase expenses, such as closing costs, title insurance, and any settlement fees.

To this figure, you can add the cost of any additions and improvements you made with a useful life of over one year.

Finally, add your selling costs, like real estate agent commissions and attorney fees, as well as any transfer taxes you incurred.

By the time you finish totaling the costs of buying, selling, and improving the property, your capital gain on the sale will likely be much lower—enough to qualify for the exemption.

The Bottom Line

Taxes on capital gains can be substantial. Fortunately, the Taxpayer Relief Act of 1997 provides some relief to homeowners who meet certain IRS criteria. For single tax filers, up to $250,000 of the capital gains can be excluded, and for married tax filers filing jointly, up to $500,000 of the capital gains can be excluded. For gains exceeding these thresholds, capital gains rates are applied.

There are exceptions for certain situations, such as divorce and military deployment, as well as rules for when sales must be reported. Understanding the tax rules and staying abreast of tax changes can help you better prepare for the sale of your home. And if you’re in the market for a new home, consider comparing the best mortgage rates before applying for a loan.

Article Sources
Investopedia requires writers to use primary sources to support their work. These include white papers, government data, original reporting, and interviews with industry experts. We also reference original research from other reputable publishers where appropriate. You can learn more about the standards we follow in producing accurate, unbiased content in our editorial policy.
  1. Congress.gov, U.S. Congress. “H.R.2014—Taxpayer Relief Act of 1997.”

  2. Internal Revenue Service. “Topic No. 701 Sale of Your Home.”

  3. Internal Revenue Service. “Publication 523: Selling Your Home,” Page 8.

  4. Internal Revenue Service. “Publication 523: Selling Your Home,” Page 3.

  5. Internal Revenue Service. “IRS Provides Tax Inflation Adjustments for Tax Year 2021.”

  6. Internal Revenue Service. “Topic No. 409 Capital Gains and Losses.”

  7. Internal Revenue Service. “Part III Administrative, Procedural, and Miscellaneous,” Page 9.

  8. Congress.gov, U.S. Congress. “H.R.1—An Act to Provide for Reconciliation Pursuant to Titles II and V of the Concurrent Resolution on the Budget for Fiscal Year 2018.

  9. Internal Revenue Service. “Publication 527: Residential Rental Property (Including Rental of Vacation Homes),” Page 3.

  10. Internal Revenue Service. “Like-Kind Exchanges—Real Estate Tax Tips.”

  11. Internal Revenue Service. “Instructions for Form 8824 (2022): Like-Kind Exchanges (and Section 1043 Conflict-of-Interest Sales).”

  12. Congress.gov, U.S. Congress. “American Jobs Creation Act of 2004: 118 Stat. 1597,” Page 181.

  13. Internal Revenue Service. “Frequently Asked Questions: Property (Basis, Sale of Home, etc.) 5.”

  14. Congress.gov, U.S. Congress. “H.R.3221—Housing and Economic Recovery Act of 2008: Division C—Housing Assistance Tax Act of 2008.”

  15. Internal Revenue Service. “Publication 537: Installment Sales,” Page 2.

  16. Internal Revenue Service. “Publication 523: Selling Your Home,” Page 9.

  17. Internal Revenue Service. “Publication 523: Selling Your Home,” Page 10.

  18. Internal Revenue Service. “Frequently Asked Questions: Gifts & Inheritances.”

  19. Internal Revenue Service. “Instructions for Form 1099-S (01/2022).”

  20. Internal Revenue Service. “Publication 523: Selling Your Home,” Pages 4–5.

  21. Internal Revenue Service. “Capital Gains, Losses, and Sale of Home.”