Email FacebookTwitterMenu burgerClose thin

How to Avoid Capital Gains Tax When Selling a House

SmartAsset maintains strict editorial integrity. It doesn’t provide legal, tax, accounting or financial advice and isn’t a financial planner, broker, lawyer or tax adviser. Consult with your own advisers for guidance. Opinions, analyses, reviews or recommendations expressed in this post are only the author’s and for informational purposes. This post may contain links from advertisers, and we may receive compensation for marketing their products or services or if users purchase products or services. | Marketing Disclosure
Share

There’s a lot of pride associated with owning a property, whether it’s a primary home or a vacation bungalow. It’s especially rewarding if your home fetches a high price when you sell it. However, while a high selling price may be exciting at the moment, it typically comes with a potential drawback: As a capital asset, any gains you make on the sale of your real estate can trigger tax consequences. Avoiding capital gains taxes when selling a house entirely is not always possible, but the federal home-sale exclusion and adjustments to your home’s tax basis can reduce or eliminate taxable gain in some cases.

A financial advisor can help you create a financial plan for your real estate needs and goals, including their tax implications.

What Are Capital Gains Taxes?

From personal items to investment products, almost all of your possessions are capital assets. When you sell one of these assets, such as your home, any profit you make from that sale can incur a tax called a capital gains tax.

Long-term capital gains occur when you sell an asset that you’ve held for more than one year. Short-term capital gains, on the other hand, apply when assets are held for one year or less.

While tax rates vary, long-term capital gains are typically taxed at a lower rate than short-term capital gains. The long-term capital gains tax rate varies between 0%, 15% and 20%, with the rates based on your income level. Higher rates may apply to certain gains, including unrecaptured Section 1250 gain from depreciation on rental or business property. In contrast, short-term capital gains are taxed as ordinary income, which can be a much higher rate. For 2026, federal ordinary income tax rates range from 10% to 37%.

When Do You Have to Pay Capital Gains Taxes?

Capital gains taxes only kick in for realized gains. That means they apply only when you sell an asset for more than its cost basis, or the amount of money you’ve put into the property, otherwise known as your capital investment. If a gain is unrealized, meaning its value has increased while you still own the item, then capital gains tax would not come into play.

So, if you make a profit off the sale of your property, you might have to pay capital gains tax. Let’s say you purchased a property six years ago for $200,000 and recently sold it for $300,000, resulting in a profit of $100,000. In this case, you would have to report the sale and possibly pay a capital gains tax on the profit.

One caveat, though: The IRS offers a tax exclusion if the property is your primary residence. Under this provision, you can exclude up to $250,000 of your gain from your income (up to $500,000 if you file a joint return and meet the requirements for the larger exclusion). In that scenario, if you don’t receive a Form 1099-S, you may not have to legally report the sale, as no taxes are due. 1

However, to claim this exclusion, you need to prove that you owned and lived in the property for at least two years of the previous five years. Those two years do not need to be consecutive. Generally, you also cannot have excluded gain from another home sale during the two-year period before the current sale. For married couples filing jointly who claim the full $500,000 exclusion, only one spouse needs to meet the ownership test, but both generally must meet the residence and look-back requirements.

Capital Gains Taxes on Second Homes and Investment Properties

While the IRS offers generous capital gains exclusions on primary residences, the rules change when the property is a second home, vacation property or rental real estate. These types of properties do not qualify for the exclusion unless they meet strict ownership and use criteria.

For second homes or vacation properties that were never used as a primary residence, the full gain from the sale is typically subject to capital gains tax. The holding period still matters, though: Gains on properties held more than a year qualify for long-term capital gains tax rates, while shorter holding periods trigger higher ordinary income rates.

In the case of rental properties, additional factors come into play. Depreciation allowed or allowable during rental or business use generally reduces the property’s adjusted basis and can affect the taxable gain when the property is sold. Gain attributable to depreciation deductions generally cannot be excluded under the home-sale exclusion and unrecaptured Section 1250 gain can be taxed at a maximum federal rate of 25%.

If you convert a rental into a primary residence or vice versa, the calculation becomes more complex. Even if you meet the ownership and residence tests, periods of nonqualified use can cause part of the gain to remain taxable. A separate reduced exclusion may apply in certain cases involving a change in place of employment, health or unforeseen circumstances. Special exceptions apply when determining which periods count as nonqualified use.

Recordkeeping is especially important for investment properties. Owners should maintain thorough documentation of all capital improvements, depreciation schedules and transaction records, as these will all affect the gain calculation and reporting requirements.

Consulting IRS publications or a tax professional is recommended when selling non-primary real estate, since eligibility rules, depreciation recapture and capital gains treatment may significantly impact your total tax liability.

Capital Gains Taxes on Inherited and Gifted Property

A homeowner reviews how to avoid capital gains taxes when selling a house.

Inherited homes follow a different set of capital gains rules than primary residences or investment properties. When you inherit real estate, the cost basis generally becomes the home’s fair market value at the previous owner’s date of death, although exceptions and alternate valuation rules can apply. This step-up in basis often reduces or eliminates taxable gains if the home is sold shortly afterward. If the property appreciates after inheritance, only that additional growth is subject to capital gains tax. This treatment applies whether the home becomes your residence, a rental or is sold immediately.

Gifted properties, in contrast, do not receive a step-up in basis. Instead, they generally carry over the donor’s original cost basis, which can result in much larger taxable gains when the recipient later sells the property. For example, if a parent purchased a home decades ago at a low price and gifts it to a child, the child generally takes the parent’s adjusted basis for purposes of calculating a later gain rather than today’s value. When the home is eventually sold, capital gains tax may therefore apply to appreciation that occurred before and after the gift.

Special rules apply when a gifted property is worth less than the donor’s basis at the time of the gift. In those cases, the IRS may use a dual-basis system depending on whether the sale produces a gain or a loss. Documentation matters in these situations, since the original basis, gift-date value and any improvements all affect the final tax calculation.

How Much Capital Gains Tax Do You Have to Pay on a Home Sale?

The exact amount of capital gains tax you’d pay on a home sale would depend on your taxable income, filing status and length of ownership. Your tax basis is also a major determinant.

For a home sale, the tax basis depends on how you came to own your home. Here are two possible scenarios:

  • You bought your home. In this scenario, the cost basis begins with the purchase price and includes specific closing costs. If you paid any taxes intended for the seller, those are added to the cost basis as well. Remodeling and construction expenses that increase the property’s value or longevity also contribute to the cost basis.
  • You inherited your home. Here, the cost basis generally begins with the home’s value at the time of the previous owner’s passing. This is what’s known as a step-up in basis. In this scenario, you don’t have to account for capital gains taxes dating all the way back to the property’s purchase.

How to Calculate the Taxable Gain Before You Sell

The difference between your purchase price and selling price does not necessarily equal your taxable gain. Before applying the home-sale exclusion, calculate your adjusted basis and the amount realized from the sale. This can show whether any gain will remain taxable after the exclusion.

Suppose you bought your main home for $350,000. Over the years, you spent $80,000 on qualifying capital improvements, bringing your adjusted basis to $430,000 under these simplified assumptions. You later sell the home for $800,000 and incur $40,000 of qualifying selling expenses. Your amount realized would be $760,000.

Here is the calculation:

  • $800,000 sale price – $40,000 selling expenses = $760,000 amount realized
  • $760,000 amount realized – $430,000 adjusted basis = $330,000 gain

If you are single and otherwise qualify for the full $250,000 home-sale exclusion, $80,000 of the gain would remain taxable:

  • $330,000 gain – $250,000 exclusion = $80,000 taxable gain

If a married couple filing jointly had the same numbers and qualified for the full $500,000 exclusion, the $330,000 gain could generally be excluded in full. The calculation can be more complicated if the property was rented, used for business, acquired in a like-kind exchange or subject to periods of nonqualified use.

How to Avoid Capital Gains Taxes When Selling a House

If you want to make a profit from the sale of your house, you will not necessarily owe capital gains taxes. There are some legal methods to minimize capital gains taxes, such as:

  • Follow the two-out-of-five-year rule: To apply this rule, you must have used the home as your primary residence for at least two of the previous five years. You don’t have to live in the house for two years consecutively, just cumulatively, to qualify for the capital gains tax exclusion. Just those two years typically allow you to meet the use and ownership tests, assuming you’ve also owned the home for the same two-of-five-year period. Together, you can qualify for an exclusion of up to $250,000 as an individual or $500,000 as a joint filer if the applicable requirements are met. 2
  • Qualify for a partial exclusion: According to IRS Publication 523, certain situations may make you eligible for an exclusion of gain. For instance, if you sold the home because of work, your health or an “unforeseeable event,” you may be able to exclude some of your taxable gains.
  • Hold on to home improvement receipts: Remember, as we discussed above, the cost basis of your property involves more than just its purchase price. It also includes any capital improvements you made. The higher your cost basis is, the lower your potential exposure to capital gains tax.

Bottom Line

If you're planning on selling your home, it's important to understand whether you can avoid capital gains taxes when selling a home.

Everyone wants to make a profit when they sell their home. However, there are expenses to account for when this happens, namely capital gains tax. A short-term gains tax will likely result in a higher tax rate, which is why it’s often worthwhile to hold on to a property for more than one year to qualify for the long-term capital gains rate. But keep in mind that rules vary. Different types of properties may also result in changes to your potential taxes, so make sure you’ve done your research before making a decision and review some of the potential ways to help avoid capital gains taxes when selling a house.

Tips for How to Avoid Capital Gains Taxes When Selling a House

  • Navigating the ins and outs of capital gains taxes can be challenging. If you want to understand your tax responsibility while selling your home, seek professional guidance. Finding a financial advisor doesn’t have to be hard. SmartAsset’s free tool matches you with vetted financial advisors who serve your area, and you can have a free introductory call with your advisor matches to decide which one you feel is right for you. If you’re ready to find an advisor who can help you achieve your financial goals, get started now.
  • At one point or another, you’ll face capital gains taxes. But that doesn’t mean you can’t find other areas in your life to cut back costs. If you’re an investor looking to minimize expenses, consider checking out online brokerages. They often offer low investment fees, helping you maximize your profit.

Photo credit: ©iStock.com/sturti, ©iStock.com/guvendemir, ©iStock.com/Feverpitched

Article Sources

All articles are reviewed and updated by SmartAsset’s fact-checkers for accuracy. Visit our Editorial Policy for more details on our overall journalistic standards.

  1. “Property (Basis, Sale of Home, Etc.) | Internal Revenue Service.” Home, https://www.irs.gov/faqs/capital-gains-losses-and-sale-of-home/property-basis-sale-of-home-etc. Accessed Apr. 10, 2026.
  2. “Sale of Residence – Real Estate Tax Tips | Internal Revenue Service.” Home, https://www.irs.gov/businesses/small-businesses-self-employed/sale-of-residence-real-estate-tax-tips. Accessed Apr. 10, 2026.
Back to top