Will I Owe Taxes When I Sell My Home?

Want To Reach FI Sooner? Join more than 18,000 others and get new tips and strategies from Can I Retire Yet? every week. Subscription is free. Unsubscribe anytime:

Housing prices have been soaring recently. Many of you are sitting on large capital gains on your homes. This is especially true of people who have lived in the same home for decades and/or in locations where prices have increased rapidly in recent years.

house sale taxes

Retirement plans often include selling a home to relocate or downsize. So it is wise to understand the rules on how you’ll be taxed when you sell your home.

Will you owe taxes when you sell your home? How can you limit your tax burden? What planning opportunities exist?

Are Taxes Owed on the Sale of a Primary Residence?

The tax code offers a generous exclusion from taxes on gains from the sale of a primary residence in Section 121 of the Internal Revenue Code.

IRS Topic No. 701 provides a high level overview of the tax implications on the sale of your home in easy to understand terms. IRS Publication 523 provides details and calculations for topics discussed below to determine your tax liability. 

You can reference these source documents for more details on topics covered. Let’s start with a few key points….

Capital Gain Treatment for Home Sales

If you have a capital gain from the sale of your primary residence, $250,000 of the gain is excluded from taxation for single taxpayers. For taxpayers who use the married filing jointly (MFJ) status, $500,000 of gain is excluded from taxation.

There are a few caveats. You need to meet the ownership test and the use test to qualify for these tax exclusions. 

There are also limits on how frequently you can use these exclusions. Finally, there are exceptions for unforeseeable circumstances or hardships that allow for partial exclusions if you don’t fully meet the ownership and use tests.

Ownership Test

The ownership test states that you must have owned the home for at least two out of the last five years prior to the sale. For married couples, only one spouse needs to meet this requirement.

Use Test

The use test states that you must have used the home as your residence for at least two of the last five years prior to the sale. This does not have to be two consecutive years or even two continuous years (i.e. you could have lived there eight months out of the year for the past 3 years).

Unlike the ownership test, if using the MFJ status to file taxes, both spouses need to meet the use test in order to qualify for the full tax exclusion.

Exceptions to Ownership and Use Tests

There are exceptions to the ownership and use tests to still qualify for the full tax exclusion. The most common and likely applicable are related to:

  • Separation and divorce
  • Death of a spouse
  • Extended public service that takes you away from the home.

More details can be found in IRS Publication 523. There are also situations that qualify for reduced exclusion amounts. They are covered below.

Capital Loss Treatment for Home Sales

Your home is considered personal use property. As such, there is no benefit if you experience a capital loss on the sale of your primary residence. 

Thus, you can’t use capital losses related to the sale of your home to offset other capital gains or decrease ordinary income as you can with other capital losses, such as losses from a mutual fund investment.

Calculating Capital Gains on a Home Sale

Subtract the adjusted basis in the home from the amount realized in the sale of the home to calculate your capital gain. This is relatively simple. With many people pushing or exceeding the tax exclusion limits, it is important to get this right.

Using the sale price will likely overstate the amount of gain you realized. Using your original purchase price as your basis may understate the amount of capital you have put into the home. 

Either error will cause you to overstate your gain. This could leave you with an unnecessary tax liability.

What Is the Amount Realized in a Home Sale

The amount you realize is the sale price of the home minus any selling expenses. The most notable of these are real estate commissions.

If you sell your home for $500,000 using a realtor charging a 6% commission, you would actually only realize $470,000 ($500,000-$30,000).

Other selling expenses that could reduce the amount realized include appraisal, deed preparation, and legal fees. 

Calculating a Home’s Adjusted Basis

The other variable needed in calculating the gain on the sale of a home is the adjusted basis. Adjusted basis is calculated by determining the initial basis and then adding to it to account for capital improvements performed during your ownership.

Your initial basis is determined by how you obtained the home, whether by purchasing, inheriting, or having it gifted to you. Assuming you purchased the home, the initial basis is the purchase price plus any additional expenses attributed to initially acquiring the property.

Adjust your initial basis by adding the cost of capital improvements, but not routine repairs and maintenance, made during your ownership. It is important to keep records of these improvements over the years. 

If you are approaching or have exceeded the allowable tax exclusions based on your original basis, having good records of these improvements could be very valuable. Let’s consider an example.

Assume you bought a home decades ago for $100,000. In the ensuing decades, prices in that area have increased considerably. The house would now sell for $1 million. If the sellers were a married couple with a $500,000 exclusion, they would still owe taxes on $400,000 of long-term gains.

However, capital improvements like putting on a new roof, putting in a new kitchen, getting a new furnace, adding a patio, etc. over their decades of ownership would increase the basis in the home. 

If you spent $200,000 on these projects, that would increase your basis from $100,000 to $300,000. Your taxable gains would be cut in half, saving tens of thousands of dollars in taxes.

Multiple Use Of Exclusions

In general, you can’t claim the Section 121 exclusion if you’ve already used it on another home in the preceding two years. Understanding this rule could be important for planning in a number of situations. I’ll highlight two.

Downsizing

Imagine a married couple with a $400,000 gain on their large primary residence where they raised their family. They also have a second vacation property with a $200,000 gain. 

They’ve reached a point in life where they would like to start downsizing. Keeping the large house where they raised their family no longer makes sense. They also would like to sell the vacation property to free up cash to travel to novel places in retirement.

If they sold both properties simultaneously, they would pay no tax on their primary residence. They would realize a $200,000 gain on the vacation home. Assuming a 15% long-term capital gains rate, they would pay $30,000 tax on the sale of this property.

Instead, they could sell the family home with the $400,000 gain first with no tax consequences. If they moved into the vacation property for two years after selling the family home, it would become their primary residence.

Thus they would meet the use test. If they then sold it after living in it for two years, they would owe no tax on this property either. They would save $30,000 capital gains taxes.

Combining Households

Let’s create another hypothetical situation. Dick and Jane marry later in life. Dick was a lifelong bachelor with a home that has a $225,000 gain. 

Jane is a widow who stayed in the home where she raised her family. Her home has a $400,000 capital gain.

The couple agrees they would like to sell both homes and start anew together. If they sold both homes before marrying, Dick would pay no tax on the $225,000 gain on his residence. 

However, Jane would exceed the $250,000 exclusion for a single. She would owe tax on the $150,000 gain above the exclusion.

Alternatively, Dick could sell his home, recognizing no taxable gain. They could then live together in Jane’s home for two years. After that time, they could sell it and use the $500,000 exclusion available to married couples that meet the ownership and use tests.

Partial Exclusions

The tax code also allows for partial tax exclusions on gains from the sale of a home for taxpayers who don’t meet the ownership and use tests for a wide variety of hardships and unforeseeable circumstances. 

The list of hardships and unforeseeable circumstances includes needing to move due to:

  • A change in work conditions (transfer by employer or choosing to take a new position)
  • Health related issues for yourself or a family member.
  • Home destroyed, damaged, or condemned by natural or man-made disaster
  • Divorce or separation
  • Multiple birth pregnancy
  • Financial challenges related to unemployment or change in employment status.

If you qualify for a partial exclusion, you calculate the amount of the exclusion based on how long you lived in the property. Divide the number of days you did meet the ownership and use tests by 730. 

The result is the percentage of time in the past two years you met these tests. Multiply that number by either $250,000 (if filing single) or $500,000 (if MFJ) to determine your exclusion.

For example, assume a single person sold a house she lived in for exactly one year. She is moving because her work transferred her out of state. 

Dividing 365 (the number of days owning and living in the house) by the 730 divisor equals .5. Next, multiply .5 by her full $250,000 exclusion for a single filer to arrive at her partial exclusion of $125,000. Any gains up to $125,000 recognized on the sale of the home would be tax free.

A full list of conditions that qualify for a partial exclusion and details of the calculations are found in IRS Publication 523.

An Alternative Option — Never Selling

It is worth noting that there is another way to avoid paying capital gains tax on your house– never sell it. This may be the best option for people in a situation where capital gains on your residence far exceed the allowed tax exclusion.

For the vast majority of people, there are no federal inheritance or estate taxes. Estates are exempt from federal taxation unless gross assets and prior taxable gifts exceed $12,060,000 in 2022. There is no federal inheritance tax.

Before considering this strategy, you would want to check if you would be subject to either estate or inheritance taxes on the state level. The majority of states have neither.

If you can avoid estate and inheritance taxes, you can pass your residence to your heirs who get a step up in basis. Their new basis is the fair market value of the home on the date of the owner’s death. They can then turn around and sell the home with little or no capital gains, and thus little or no taxes.

Take Home Points

The IRS Section 121 tax exclusion on the sale of your home offers a significant tax break when it comes time to sell your home.

It is important to keep good records when selling your home so you don’t overstate the amount you recognize. Likewise, you don’t want to understate the basis in your home because you don’t account for purchasing costs and capital repairs made during your ownership. Either error can cause you to overstate your gains and create an unnecessary tax liability.

You are allowed multiple uses of this exclusion over time. This can present valuable planning opportunities if you time the sales wisely.

There are generous exceptions to the ownership and use tests for some public servants and those who experience hardships. There are also partial exclusions available for a wide variety of hardships and unforeseeable events.

Finally, if all else fails, there is the option to not sell your home and pass it on to your heirs, often with little or no tax consequences.

As with all tax planning topics, it is wise to learn the rules. Apply them to your particular situation to limit your tax burden.

* * *

Valuable Resources

  • The Best Retirement Calculators can help you perform detailed retirement simulations including modeling withdrawal strategies, federal and state income taxes, healthcare expenses, and more. Can I Retire Yet? partners with two of the best.
  • Free Travel or Cash Back with credit card rewards and sign up bonuses.
  • Monitor Your Investment Portfolio
    • Sign up for a free Personal Capital account to gain access to track your asset allocation, investment performance, individual account balances, net worth, cash flow, and investment expenses.
  • Our Books

* * *

[Chris Mamula used principles of traditional retirement planning, combined with creative lifestyle design, to retire from a career as a physical therapist at age 41. After poor experiences with the financial industry early in his professional life, he educated himself on investing and tax planning. Now he draws on his experience to write about wealth building, DIY investing, financial planning, early retirement, and lifestyle design at Can I Retire Yet? Chris has been featured on MarketWatch, Morningstar, U.S. News & World Report, and Business Insider. He is also the primary author of the book Choose FI: Your Blueprint to Financial Independence. You can reach him at chris@caniretireyet.com.]

* * *

Disclosure: Can I Retire Yet? has partnered with CardRatings for our coverage of credit card products. Can I Retire Yet? and CardRatings may receive a commission from card issuers. Other links on this site, like the Amazon, NewRetirement, Pralana, and Personal Capital links are also affiliate links. As an affiliate we earn from qualifying purchases. If you click on one of these links and buy from the affiliated company, then we receive some compensation. The income helps to keep this blog going. Affiliate links do not increase your cost, and we only use them for products or services that we're familiar with and that we feel may deliver value to you. By contrast, we have limited control over most of the display ads on this site. Though we do attempt to block objectionable content. Buyer beware.

14 Comments

  1. More people need to think like this in terms of more “advantageous” cohabitation. Never know that a multiple birth pregnancy could exempt someone from the tax rule!

    I hope people do sell though, we already have enough people holding on to their homes and wanting to age in place. The cycle of life has so many factors.

    1. Gary,

      I agree that there are a lot of interesting quirks to this section of the tax code. With such a shortage of housing it would be great to encourage more sellers and that may be a motivator to increase the exclusions in the future if a lot of people are unwilling to sell due to tax consequences. It’s something worth keeping an eye on.

      Best,
      Chris

  2. There’s an additional advantage to the “never sell” option. The heirs get a step-up in basis, as you point out, but in addition this is the rare circumstance where sale of the house will generate a deductible loss. Let’s say the house is worth $1 million on the date of death, and the executor (or heir) sells the house for that amount. The stepped-up basis is $1 million, but likely there were costs of sale – let’s say 6% commission = $60,000. So the net gain is $940,000, resulting in a capital loss of $60,000. If the heir has not lived in the house, it is considered a capital asset of the estate and NOT a personal asset. The loss flows through to the heir on the estate’s K-1, and the heir can use it in the same way as any other capital loss. I discovered this when I was executor of an estate recently, and luckily I had a very knowledgeable accountant (though I also confirmed this in the relevant IRS publications).

    Thanks for a great site and your usual helpful info!

    1. Thanks for sharing this Coriander!

      I often learn as much from reader experience and expertise as I do my own research. That is certainly the case here as I’ve never heard of this situation. That makes sense to me, but as always I would recommend others to check with an attorney or accountant to make sure the specifics of this situation translate to their own before making any assumptions.

      Best,
      Chris

  3. Hello: Thank you for all you hard work on a variety of topics! I’ve wondered about our situation. We bought 30 acres with our house in 1995, adjoining 23 acres (land only) in 1996, and adjoining 120 acres (land only) in 2004. What would be the tax implications when we sold home with 173 acres? We’ve both early retired a long time ago and will probably move one of these years.

    1. Nancy,

      That is a great question. I can’t give any specific advice, so double check with an attorney or accountant with expertise in this topic.

      My understanding is if you sold the properties piece meal (as you bought them) that the land would be taxed as investment property and the 30 acres with the home would qualify for the Section 121 exclusion (assuming you met the tests as described). If you combined them and sold them as one, I am not aware of any limitations on acreage, and so I would assume the cost of the land would be added to your basis and the entire sale would be subject to the tax exclusion up to the applicable limits (though with that much land, it seems likely you would exceed the exclusion anyway). This source covers this topic with links to relevant supporting treasury regulations.

      Again, this is just my thinking through the question and should NOT be construed as advice. If you do talk to an attorney or accountant or find an authoritative source, I would be curious to hear what you learn.

      Best,
      Chris

  4. Thanks for the informative discussion! While you characterize the IRS exclusion on primary residence capital gain as “generous”, the amounts have been unchanged since they were established by the 1997 Taxpayer Relief Act. Given the
    tremendous gains in home prices, especially during the past 10 years, maybe it’s time to lobby for an increase in the exclusion amounts. Also it might make sense to build in some sort of tiered exclusion, where an elderly couple who’ve owned their home for 20 or 30 years, for example, would receive a more generous exclusion than an “investor” flipping a house after two or three years.

    1. BJ,

      You make a good point regarding the use of the word “generous.” My evolving perception of that is actually what prompted me to write this post.

      When we sold our last home after over a decade of ownership, we recognized virtually no gain and the thought of a $500k gain seemed like an outlier. With recent general inflation and the more rapid inflation in home prices, we are already over half way to the $500k exclusion in less than 5 years in our current home, which we purchased for less than $250k. As I think about people in our neighborhood and others experiencing rapid price increases, especially those who have lived in their homes for decades in these areas, there are likely many people who will exceed the exclusions.

      The ideas such as making sure of keeping good records of capital improvements is likely very important to limit our future tax liability as there is a good chance we’ll exceed the exclusion amounts assuming we stay here at least another decade until our daughter finishes high school. It will be interesting to see if the exclusion increases, but until the time that it does it is wise to plan based on the rules as they currently are written.

      Best,
      Chris

  5. Hello!
    Great article! 2 questions
    1. Can tax loss harvesting reduce the amount of gains received from a primary home sale?
    2. Can you confirm that a mortgage loan does not enter the equation of deciding the basis of the home? i.e. the loan reduces the proceeds in the eyes of the IRS

    1. Corey D.

      As always I can’t provide specific financial or tax advice on the blog and I’m also not sure I fully understand your questions, but if I understand them correctly:

      1.)If you exceed the exclusion on the sale of your home and owe tax, it would be added to other capital gains and netted against other losses to arrive at the final gain that would be taxable. So yes, tax loss harvesting from investments could offset some of the gains from a home sale. However, this would lower the basis on your investments, possibly creating a larger bill there in the future. The big difference is that losses on a home could not be used to offset other capital gains or ordinary income as could other capital losses, such as say from a stock investment.

      2.) I believe you’re asking whether the basis in your home is dependent on how you pay for it. I.e. would the basis differ if you paid cash vs. financing with a mortgage. If so, this should answer that question and direct you to the appropriate source documents.

      Best,
      Chris

  6. I’m hoping that the $500k limit is updated for modern times. I believe this amount has been the same for over 25 years now and it only makes sense that it would be adjusted for inflation. It should be double, how lucky were those people taking the max back in 1997! We are looking at $2M + in capital gains if/when it is sold, as I was fortunate to have purchased an amazing home/property in foreclosure during the depths of last housing/financial crisis. It was scary because nobody else was buying! Maybe it makes more sense to borrow against the asset vs. selling depending on a person’s age and financial situation.

    1. Thanks for sharing that insight Ol70. As I noted above, as someone who sold my last house after a decade with no capital gains, the idea of having a $500k gain seemed generous. Now that I live in a red hot market in a time of general inflation which is particularly impacting home prices, it seems likely we’ll exceed the exclusion by the time we’re ready to sell. Similar to state taxes, some real estate issues are hard to write about for a broad audience, because real estate markets vary so widely from locale to locale.

      I agree that strategies to stay in the home if at all possible may make more sense for someone in a situation like yours.

      Best,
      Chris

  7. Thank you for this article. Is the $500,000 capital gain exclusion only available for MFJ couples? What about unmarried couples, or family members who chose to buy and live together like siblings? Do they still get $500,000 in exclusions total (each get $250,000)?

    1. Louise,

      Interesting question. The exclusion is based on filing status. So for married couples this question is easy. The exemption is $500k for MFJ couples who have met ownership and occupancy tests as explained above.

      I am not aware how that would work for unmarried couples, siblings, etc. if they meet each meet ownership and occupancy tests on a home in which each has an ownership stake. Would each be able to take the $250k exclusion? I suspect not, particularly if say there were three siblings that owned and thus they could then take a $250k exclusion (X3 =$750k on a single home). However, that would be a good question for an attorney and/or accountant familiar with this area of the tax code.

      I suspect that you have a reason for asking, so if this applies to you and you find an authoritative answer, I’d appreciate if you would be willing to share it.

      Best,
      Chris

Comments are closed.