Can you avoid capital gains by paying off your mortgage? How home sale taxes really work

Contributed by Sarah Henseler

Updated Apr 27, 2026

8-minute read

Share:

Woman snuggling fluffy dog on couch.

Selling your home can be an exciting financial milestone, though you may still have questions about how much you’ll make from the deal. Paying off your mortgage can change how much cash you walk away with at closing, but it usually doesn’t change whether you owe capital gains tax.

If you’re trying to avoid capital gains tax on home sale profits, the strategies that matter are IRS exclusions and how your gain is calculated. Calculating capital gains taxes can seem intimidating, so we’ll break down exactly how these taxes work, share common exclusions, and help you understand your options.

Key takeaways:

  • Mortgage payoff doesn’t usually affect capital gains tax. It affects net proceeds, not how gain is calculated.
  • Many homeowners can exclude up to $250,000 - $500,000 if they meet Section 121 rules, which require specific ownership and use tests.
  • Your cost basis matters. Improvements and certain selling costs can reduce your taxable gain.

What are capital gains taxes?

A capital gain is the profit you make when you sell an asset, like a house, for more than you originally paid for it. The IRS taxes these profits, but the rate depends heavily on how long you owned the property.

If you owned the home for 1 year or less, your profit is considered a short-term capital gain and is taxed at your ordinary income tax rate. If you owned it for more than 1 year, it is a long-term capital gain, which typically qualifies for significantly lower tax rates.

Capital gains tax is tied to your profit on the sale. Whether you still have a mortgage balance typically doesn’t change the taxable gain.

See what you qualify for

Get started

Does paying off your mortgage help you avoid capital gains tax?

It’s a common question, but paying off your mortgage usually doesn’t change your capital gains tax. If you’re hoping to avoid capital gains by paying off mortgage debt before selling, you might be surprised to learn that it doesn’t change what you owe the IRS.

To understand why, it’s helpful to know the difference between your taxable gain and your net proceeds:

  • Net proceeds: This is your sale price minus your mortgage payoff and other closing costs. Simply put, this is the cash you take home at closing.
  • Taxable gain: This is your sale price minus your adjusted basis (what you originally paid plus qualifying improvements) and eligible selling costs. This is the actual number the IRS looks at

Mortgage payoff changes the cash in your pocket, not necessarily the tax owed. What should you do instead? Focus on these proven strategies to lower your tax bill:

  • Check your Section 121 eligibility.
  • Track your improvements and eligible selling expenses.
  • See if you qualify for partial exclusions.
  • If it’s an investment property, consider whether a 1031 exchange applies.

Get approved to buy a home

Rocket Mortgage® lets you get to house hunting sooner

Ways to avoid capital gains taxes on real estate

Capital gains taxes can take a bite out of your home sale profits, but they don’t have to. With the right strategy, you may be able to reduce or even avoid them altogether. Understanding these legal options can help you keep more of your earnings and confidently take your next step, whether it’s into a new home or a new opportunity.

In tax terms, “avoid” usually means you can exclude, reduce, or defer gains under IRS rules. Let’s walk through the most common options for managing capital gains tax on real estate.

121 home sale exclusions

If you’re selling your primary residence, the IRS offers a major advantage through the Section 121 exclusion. This rule allows you to exclude up to $250,000 of profit from capital gains taxes if you’re single, or up to $500,000 if you’re married and filing jointly, so long as you’ve owned and lived in the home for at least 2 of the past 5 years. This exclusion can make a significant difference in how much you walk away with after closing.

Eligibility: To qualify for the capital gains exclusion, you must have owned and lived in the home as your primary residence for at least 2 of the 5 years before the sale. This doesn’t need to be continuous time, but it must add up to 24 months within that 5-year window.

Numerous types of homes are eligible for the home sale exclusion, including:

  • Mobile homes
  • Trailers
  • Houseboats
  • Condominiums
  • Single-family homes
  • Cooperative apartments

Limitations: If you meet the requirements, you can exclude up to $250,000 in capital gains if you file as single or married filing separately, and up to $500,000 if you file jointly with a spouse. This exclusion can only be used once every 2 years, so if you've already claimed it during that time, you'll need to wait before applying it to another sale.

1031 like-kind exchange

If you are selling a rental home or commercial building, the 1031 exchange rule allows you to defer paying capital gains taxes by reinvesting the profits from your sale into a new property of the same nature or character. It’s a smart move for investors looking to grow their portfolios without triggering an immediate tax bill.

Eligibility: The property being sold must be held for investment or business purposes, not as a primary residence. To qualify for a 1031 like-kind exchange, you must:

  • Identify a replacement property within 45 days of selling the original property.
  • Close on the new property within 180 days of the original sale.
  • Use a Qualified Intermediary (QI) to hold and transfer the sale proceeds.
  • Purchase a replacement property of equal or greater value to fully defer taxes.

Limitations:

  • The transaction must follow strict IRS rules, including timely identification and closing.
  • You must reinvest all proceeds; otherwise, the unused portion may be taxed.
  • You must report the transaction to the IRS using Form 8824 during the same tax year of the exchange.
  • Deferral is not permanent. Capital gains taxes will apply if you sell the new property later without another exchange.

Apply for a Home Equity Loan online

The Rocket Mortgage® online application is simple and secure

Other ways to minimize capital gains taxes

There’s more than one way to protect your profit on the sale of your home. The IRS provides several opportunities for homeowners to reduce or defer their tax burden, if you know where to look.

By understanding and leveraging these strategies, whether you’re relocating, upgrading your home, or working in public service, you can make confident decisions that align with your financial goals and minimize your tax burden legally and effectively.

Live in the house for at least 2 years

If you live in your home for at least 2 out of the 5 years before selling, you may qualify for the Section 121 exclusion. If you have lived in your primary residence for 23 months, it may be worth waiting just one more month to list your home. By reaching the 24-month mark, you can unlock the full Section 121 exclusion and potentially save yourself thousands of dollars in taxes.

For example, if you bought your home for $300,000 and sold it for $600,000 after living in it for over 2 years, you could potentially exclude the entire $300,000 profit from your taxable income, assuming you meet the other requirements.

Determine if you qualify for exceptions

Even if you don’t meet the full 2-year requirement, you may still qualify for a partial exclusion under special circumstances. The IRS makes exceptions for taxpayers who need to sell their home due to unforeseen events, allowing you to exclude a prorated portion of your capital gains.

You have to sell because of a job or illness: If you have to move because of a sudden change in employment, you may qualify for a partial exclusion. To be eligible, your new job location needs to be at least 50 miles farther from your home than your old job. For instance, if you’ve only lived in the home for 1 year but have to relocate 75 miles away for a new job, you might be eligible to exclude half of the standard exclusion.

Similarly, if you sell your home to move closer to a doctor for treatment of an illness, or to care for a family member suffering from a serious medical condition, the IRS often grants a partial exclusion to help ease your financial burden.

Tax preparers and financial professionals can help you document and validate the reason for your move and ensure the IRS recognizes your exception. 

You work for the federal government: Some federal employees receive special consideration that extends the 5-year eligibility window for capital gains exclusions. Specifically, if you're serving on qualified official extended duty, you may suspend the 5-year test period for up to 10 years, giving you more time to qualify for the home sale exclusion.

Qualified official extended duty generally means you are ordered to a duty station that is at least 50 miles from your main home or are required to reside in government quarters. This generous exception means you could potentially rent out your home while stationed elsewhere and still claim the exclusion when you eventually sell.

Federal employees who qualify for this exception include:

  • Foreign service members
  • Intelligence community employees
  • Members of the uniformed services stationed away from home

This extension gives federal employees the flexibility to sell their homes without losing the chance to exclude their capital gains, even if they’ve been away for extended periods due to service.

Write off improvements on the home

Another smart way to reduce your capital gains liability is by increasing your cost basis. Cost basis is the amount you originally invested in the home. Improvements you make to the property can be added to your cost basis, which reduces the size of your taxable gain when you sell.

Let’s say you purchased your home for $400,000 and later added a new roof, remodeled the kitchen, and upgraded the HVAC system for a total of $50,000. Your adjusted basis becomes $450,000. If you sell for $600,000, your capital gain is only $150,000 instead of $200,000.

FAQ about capital gains taxes

Still have questions about capital gains? We’ve got answers.

What is the $250,000/$500,000 capital gains tax exclusion?

The $250,000/$500,000 capital gains tax exclusion is an IRS provision that allows homeowners to exclude up to $250,000 of profit from the sale of their primary residence if they file as single, or up to $500,000 if they’re married filing jointly. To qualify, you must have owned and lived in the home for at least 2 of the 5 years before the sale. This exclusion can be used once every 2 years and helps reduce or eliminate capital gains taxes on qualifying home sales. Paying off your mortgage doesn’t change whether you qualify for this exclusion.

Can you avoid capital gains by paying off your mortgage?

No. Paying off your mortgage generally affects your net proceeds, not your taxable gain. Your mortgage payoff simply changes the cash you walk away with. To legally reduce or avoid capital gains tax, focus on the Section 121 exclusion and adjusting your basis.

Do I pay capital gains taxes if I inherit a property?

Generally, you don’t pay capital gains taxes at the time you inherit a property. However, if you later sell the inherited property, you may owe capital gains taxes on the profit. It’s calculated using a “stepped-up basis,” which adjusts the property’s value to its fair market value at the time of the original owner’s death. This often reduces or eliminates the taxable gain when the property is sold soon after inheritance.

Are there capital gains taxes if I sell a house after divorce?

If a home is transferred between spouses during a divorce settlement, there is generally no immediate capital gains tax. If you sell your house after the divorce, capital gains tax may apply. However, if the home was your primary residence and you meet the ownership and use requirements, you may still qualify for the $250,000 exclusion as a single filer, even if the home was previously owned jointly. 

The bottom line: Capital gains taxes can be avoided or minimized, but not by paying off your mortgage

Selling a home or investment property can be a rewarding milestone. But without a clear understanding of capital gains taxes, it can also become an unexpected financial burden.As you plan your next move, it’s important to weigh all your options.

If you're a homeowner not quite ready to sell, consider applying for a home equity loan to fund upgrades or renovations that can boost your property’s value and improve your quality of life. Mortgage payoff affects how much you net. Exclusions, exceptions, and cost basis are what typically affect your capital gains tax picture.

No matter your path forward, taking the time to understand your capital gains exposure and exploring tax-smart strategies can help you protect your profit, plan your future, and make your next real estate move with confidence.

Rocket Mortgage is a trademark of Rocket Mortgage, LLC or its affiliates.

Headshot of Michelle Banaszak.

Michelle Banaszak

Michelle graduated from Michigan State University in 2011 with a Bachelor's in Communications and a Bachelor's in Studio Art. She's been writing for various companies since she graduated, and enjoys bringing stories and information to life. She currently works for Blue Cross Blue Shield of Michigan as a Communication Specialist and is a recent first-time homeowner.