Reducing or Avoiding Capital Gains Tax on Home Sales

Part of the Series
Sell Smart: The Homeowners Guide

Key Takeaways

  • You can sell your primary residence and be exempt from capital gains taxes on the first $250,000 if you're 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.

You could owe capital gains tax if you sell a home that has appreciated in value because it's a capital asset. However, thanks to the Taxpayer Relief Act of 1997, most homeowners are exempt from needing to pay it. If you're single, you'll 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.

A smiling family greeting a professional outside of a house
Living in a home for two of the past five years means it qualifies as your primary residence.

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.

Important

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.

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.

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

Widowed Taxpayers

Widowed taxpayers may be able to increase the exclusion amount to $500,000 from $250,000 when meeting all the following conditions:

  1. They sell their home within two years of the death of their spouse.
  2. They haven’t remarried at the time of the sale.
  3. Neither the seller or their late spouse took the exclusion on another home sold less than two years before the date of the current home sale.
  4. They meet the two-year ownership and residence requirements.

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's 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 don't have to be in a particular block of time.

One caveat: For married taxpayers filing jointly to qualify for the $500,000 exclusion, each spouse has to have met the residence requirement, even if only one spouse is the owner of the property. For example, a married couple filing jointly sells their primary residence, which is owned by one spouse. Both spouses have lived in the house for 24 months out of the previous five years, so the couple qualifies for the $500,000 exclusion.

By comparison, a recently married couple filing jointly sells their primary residence, which is owned by one spouse. The owner's spouse has lived in the house for 24 months out of the previous five years, but the non-owner spouse has only lived in the house for 12 months out of the five years. This couple wouldn't qualify for the $500,000 exclusion, just the $250,000 exclusion for the owner who met the residence requirement.

How the Capital Gains Tax Works With Homes

Suppose you purchase a new condo for $300,000, live in it for three years, and then sell it for $450,000. No capital gains tax is due because the profit ($450,000 - $300,000 = $150,000) doesn't exceed the exclusion amount.

Consider an alternative ending in which home values in your area increased dramatically.

In this scenario, you sell the same 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 $48,350–$533,400 range, for 2025, your capital gains 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.

2025 Long-Term Capital Gains Rates (for Taxes Due in 2026)
Filing Status 0% Tax Rate 15% Tax Rate 20% Tax Rate
Single $48,350 $48,351 to $533,400 $533,401 or more
Married filing jointly $96,700 $96,701 to $600,050 $600,051 or more
Married filing separately $48,350 $48,351 to $300,000 $300,001 or more
Head of household $64,750 $64,751 to $566,700 $566,701 or more
Applicable to the Sale of a Principal Residence

Source: Internal Revenue Service

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 restriction is that you can only benefit from this exemption once every two years. Therefore, if you have two homes and have 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 because you sold the first one.

Tip

The Taxpayer Relief Act of 1997 made home sale rules more favorable 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. This no longer applies, and the sale proceeds 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 isn't 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 wasn't 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 of 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 either 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're 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 for 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 doesn't qualify for the capital gains exclusion.

For the IRS to define a second home as a personal residence for a tax year, you must use it for more than 14 days, or 10% of the number of days that you rent it out, whichever is greater. For example, if the house is rented for 40 weeks (280 days), you would need to use the home for more than 28 days.

Fast Fact

Deferrals of capital gains tax are allowed for investment properties under the 1031 exchange if the sale proceeds are used to purchase a like-kind investment.

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, you can 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. The latter is used for short-term stays, primarily for vacations.

Homeowners often convert their vacation homes to rental properties when they're 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 isn't 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's 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 generally won't 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.

Let’s explore other ways to reduce or avoid capital gains taxes on home sales.

Use 1031 Exchanges to Avoid Taxes

A 1031 exchange, named after Internal Revenue Code Section 1031, lets homeowners defer taxes from the proceeds of a home sale into a similar property. This like-kind exchange allows properties to be exchanged with no other consideration, payment, or like property, including cash. It permits the tax on the gain from the sale of a property to be deferred, rather than eliminated.

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

Important

Because 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.

The properties subject to the 1031 exchange must be for business or investment purposes, not for personal use. In a 1031 exchange, replacement properties must be identified in writing within 45 days, and the exchange must be completed within 180 days from the sale.

The American Jobs Creation Act of 2004 requires owners to hold exchanged property for at least five years to qualify for the capital gains exclusion..

According to an IRS memo, homeowners can avoid full capital gains tax on a second home only if it’s treated as an investment property exchanged for another. The home must be owned for at least two years, rented at a fair rate for at least 14 days in each of those years, and limited personal use to 14 days or 10% of the rental time, whichever is greater.

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 their use throughout their lifetime. Because gains on non-principal residences and rental properties don't have the same exclusions, people have sought 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.

Tip

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 to using a second home as a principal residence apply. Deductions for depreciation on gains earned before May 6, 1997, won't be considered in the exclusion.

According to the Housing Assistance Tax Act of 2008, a homeowner can only claim the capital gains exclusion for the time the property was their principal residence. The capital gains are allocated to the entire period of ownership. The time it was a rental property counts as a non-qualifying use and isn’t eligible for the exclusion.

How Installment Sales Lower Taxes

Realizing a large profit when you sell an investment is the dream. However, the corresponding tax on the sale may not be. Owners of rental properties and second homes can reduce the tax impact by choosing 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 owner holds the property determines how it’s taxed: as 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 (i.e., 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 a home for $400,000. They made no improvements and incurred no losses for the 12 years that they lived there. In 2022, they sold their home for $550,000. Their cost basis was $400,000, and their taxable gain was $150,000. They 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).

Warning

Improvements needed to maintain the home with no added value, those that have a useful life of less than one year, or are no longer part of your home, won't increase your cost basis.

Some events and activities can also 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 the property.

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're left a house for which the original owner paid $50,000. The home was valued at $400,000 when the original owner died. 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's 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, make sure you inform your real estate professional of the transaction.

If you qualify to exclude capital gains on your home sale, let your real estate professional know soon after the sale or by early the following year.

The IRS details which transactions aren't reportable:

  • If the sales price is $250,000 ($500,000 for married people) or less, 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 payment for the transaction is $600 or less, which is called a de minimis transfer

Special Situations: Divorce and Military Personnel

Getting divorced or being transferred because you're military personnel can complicate a taxpayer’s ability to qualify for the minimum amount of time spent in a property, known as the use requirement, for capital gains tax exclusions on home sales. But 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. 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. As long as the military member occupies the home for two out of 15 years, they qualify for the capital gains exclusion.

Can Home Sales Be Tax-Free?

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 don't 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 don't exceed the exclusion threshold ($250,000 for single people and $500,000 for married people filing jointly), the seller doesn't 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, which include:

  • Offset your capital gains with capital losses. Capital losses from previous years can be carried forward to offset gains in future years.
  • Use the 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?

The tax you pay depends on the amount of the gain from selling your house and on your tax bracket. If your profits aren't more than the exclusion amount and you meet the IRS guidelines for claiming the exclusion, you owe nothing. If your profits exceed the exclusion amount, which often changes annually, you will owe either a 15% tax or a 20% tax on the profits, depending on your overall taxable income.

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 probably personal property, not an 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. Additionally, 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 the costs of selling, if any.

Advisor Insight

Kimerly Polak Guerrero, CFP
Polero ICE Advisers, New York, New York

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. 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, in addition to rules for when sales must be reported. Understanding the tax rules and staying abreast of 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. 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 3.

  4. Internal Revenue Service. "IRS Releases Tax Inflation Adjustments for Tax Year 2026, Including Amendments from the One, Big, Beautiful Bill."

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

  6. Internal Revenue Service. “Publication 523, Selling Your Home." Page 4.

  7. Internal Revenue Service. “Rev. Proc. 2024-40." Page 7.

  8. Shan, Hui. "The Effect of Capital Gains Taxation on Home Sales: Evidence from the Taxpayer Relief Act of 1997." Journal of Public Economics, vol. 95, no. 1–2, February 2011, pp. 177-188.

  9. Internal Revenue Service. “Publication 523, Selling Your Home." Pages 3–4.

  10. 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.”

  11. Internal Revenue Service. "Publication 527, Residential Rental Property." Page 26.

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

  13. Internal Revenue Service. “Publication 527, Residential Rental Property." Pages 4, 28.

  14. Internal Revenue Service. “Instructions for Form 8824, Like-Kind Exchanges (and Section 1043 Conflict-of-Interest Sales).” Page 3.

  15. U.S. Congress. “American Jobs Creation Act of 2004: 118 Stat. 1597." Page 181.

  16. Internal Revenue Service. "Rev. Proc. 2008-16." Pages 3–5.

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

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

  19. Internal Revenue Service. “Publication 537, Installment Sales." Pages 2-3, 25.

  20. Internal Revenue Service. "Publication 551, Basis of Assets." Pages 3-4, 6-7.

  21. Internal Revenue Service. “Publication 523, Selling Your Home." Page 10.

  22. Internal Revenue Service. "Is Money Received from the Sale of Inherited Property Considered Taxable Income?"

  23. Internal Revenue Service. "About Form 1099-S, Proceeds from Real Estate Transactions."

  24. Internal Revenue Service. “Instructions for Form 1099-S, Proceeds From Real Estate Transactions.” Pages 1-2.

  25. Internal Revenue Service. “Publication 523, Selling Your Home." Pages 4–5.

Compare Mortgage Lenders
The offers that appear in this table are from partnerships from which Investopedia receives compensation. This compensation may impact how and where listings appear. Investopedia does not include all offers available in the marketplace.
Part of the Series
Sell Smart: The Homeowners Guide

Related Articles