The capital gains tax on real estate when you sell your house is generally 15-20% of the capital gain from the home sale. That’s a lot.
Ever wonder how to avoid paying taxes when selling a house?
If you do things right, you can actually avoid capital gains tax on the proceeds from the sale of your house by taking advantage of the capital gains tax exclusion for primary residence home sales.
This is a huge tax break for home sellers: you can exclude up to $250,000 in gain from taxes if you’re single; $500,000 if married filing joint.
This article explains exactly how the tax rules for selling a home work. The rules are tricky so pay attention to make sure you don’t accidentally disqualify yourself.
All homeowners thinking of selling their house — and even home buyers who just want to learn how to be tax-efficient — can get a LOT of value from understanding how the home sale exclusion works.
I structured this post as an FAQ. But I’ll use a bunch of examples to show you how the nuances, exceptions, and limitations work.
Click any of the links below to jump to each question.
What part of the tax code is this?
Who qualifies for the exclusion?
What type of home qualifies?
How much can you exclude?
When can you claim the exclusion?
What does the exclusion mean for tax purposes?
How many times can the exclusion on capital gains taxes be claimed?
What special rules apply to married taxpayers?
Sometimes, married couples are treated as if they were not married…
Changes to the law back in 2009
No exclusion for “periods of nonqualified use”
What is “nonqualified use”?
But some exceptions…
What happens for “periods of nonqualified use”?
Example #1: Simple case…
Example #2: Unhappy simple case…
Example #3: More complexity…
Example #4: Straddling the border
What happens when you fail to meet some of the requirements?
Examples of change in employment
Examples of change in health
Examples of other unforeseen circumstances
Great, you’re eligible for a partial exclusion! How is it actually calculated?
Two final notes about job changes, health, and other unforeseen circumstances
Let’s start with the basics….
The statute that governs the $250k / $500k exclusion on home sale gains is:
This is from the Internal Revenue Code. Feel free to click and read and compare my explanations to the statute if you’re unclear about anything.
People who satisfy the “2 out of 5 year rule.” What is the 2 out of 5 year rule?
It is a test that the IRS uses that says: people who own and use a home as a primary residence for at least 2 of the 5 years immediately prior to selling their home can qualify for the capital gains tax exclusion.
There are some exceptions to the 2 out of 5-year rule explained later in this article. The exceptions allow you to claim a partial home sale tax exclusion even when you sell your house within (or less than) 2 years of buying it. For example, if you sell your house after 1 year, you can still get a partial capital gains exclusion if you meet a few other conditions (explained below).
Basically, any home that is your primary residence. Doesn’t matter if it’s a single family home, condo, townhouse, whatever.
What determines whether a home is your primary residence is whether you are physically living in the home.
This means you cannot avoid capital gains tax on the sale of a second home. You also cannot avoid capital gains tax on rental property. For rental property, you can use Section 1031 to do a 1031 exchange and defer tax liability, but the capital gains exclusion provided by Section 121 does not apply to rental property.
Can you avoid capital gains tax by buying another house? No, you cannot – at least at the federal level. Some states or municipalities may have exceptions for state or local tax liability, (e.g. special property tax basis rules when you sell a house and buy another one), but not for federal tax liability which is where you’ll pay the most in capital gains taxes anyway.
So, whether you buy another house after selling your current primary residence doesn’t impact your federal capital gains tax liability: your eligibility for the capital gains exclusion is only based on whether the home you are selling is your primary residence.
There is also a common question re: at what age can you sell a house and not pay capital gains taxes. This is based on an outdated rule that no longer applies that previously provided a special capital gains home sale exemption for over-55 seniors who are home sellers. The over-55 home sale exemption was repealed following the passage of the Taxpayer Relief Act of 1997. It was replaced by the modern Section 121 home sale tax exclusion.
The capital gains exemption allows you to exclude up to a maximum of $250k gain if you’re single, or $500k if you’re married filing jointly.
If you sell your home for LESS gain than these amounts, the amount you can exclude will obviously be less. It’s limited to your actual gain.
For you capitalists out there, you might be thinking: “What if I sell my house to my child or a family member for $1 or below market value?”
The tax implications of selling your house below market value don’t allow you to avoid taxes. If you sell your house to a family member for $1, you won’t have to pay capital gains taxes on the sale, but you will have to pay federal gift taxes, which are imputed as the difference between the sale amount and the fair market value of the property.
Federal gift tax rates are higher than home sale capital gains tax rates, so it’s a worse deal to try to avoid home sale capital gains taxes by selling your home below market value.
Upon the sale, exchange, or involuntary conversion of your primary residence. We’ll talk more later about what “exchange” and “involuntary conversion” mean.
It means the capital gain from the sale of your home, up to $250k for single filers and $500k for married joint filers, is excluded from your income.
You can only claim this exclusion once every TWO years.
In order to get double the exclusion amount, i.e., $500k:
- At least ONE spouse must own the home for 2 of the 5 years prior to sale
- BOTH spouses must actually live in the home as their primary residence for 2 of the 5 years prior to sale
- NEITHER spouse can be in a “time out” because of the “once every 2 years” limit noted above
If you and your spouse satisfy all these criteria, hooray — you get a $500k exclusion!
But what happens when you or your spouse fail one of the criteria above?
Well, you don’t get knocked out entirely.
What happens is, the IRS grants you an exclusion AS IF you were not married.
What that means is, the IRS will evaluate each of you independently to see what your own personal exclusion WOULD have been had you been a single tax filer.
Furthermore, for purposes of that analysis, the IRS will treat BOTH spouses as having owned the property whenever EITHER owned the property.
In other words, if only ONE spouse actually held title, the IRS will fictionally assume BOTH spouses held title at the same time…but just for this one analysis.
However much exclusion each of you would be entitled to via this analysis, the IRS will take the sum of both amounts and declare that as the total exclusion you are jointly entitled to.
This may sound complicated, but you can get a feel for how it works by considering the case where, say, a woman owns and lives in a home for 3 years before marriage, then marries, and then 1 month after her wedding decides to sell her house because the couple moves to a new city for new jobs.
In that case, the husband will fail the 2-year residency requirement, so the IRS will evaluate them separately, but will fictionally assume the husband owned the house for the same time the wife owned the house — 3 years.
Then the IRS will take whatever partial exclusion the husband is entitled to, add it to whatever exclusion the wife is entitled to, and then declare the SUM to be the actual exclusion the couple is jointly entitled to.
We’ll see some detailed examples of this in a moment.
In the simple days before 2009, the rules were uncomplicated.
As long as you satisfied the 2-year residency requirement, you could claim a nice fat exclusion.
But starting in 2009, Congress decided it needed to raise more tax revenue. So it amended the rules to make home sale capital gains tax exclusion more restrictive.
Now, you have to meet the 2-year residency requirement PLUS check a few other boxes to get the full exclusion.
A lot of people will get caught by these changes, so let’s examine what they are….
Basically, the IRS now says, assuming you first meet the 2-year residency requirement, you will only be allowed to claim the tax exclusion for “periods of qualified use.”
You can no longer get it for “periods of nonqualified use” even when you meet the residency requirement.
What’s considered qualified vs. nonqualified use?
First, the IRS says the term “period of nonqualified use” means any period starting January 1, 2009, when the home is not used as a primary residence of the taxpayer or taxpayer’s spouse.
So, anything before 2009 still counts under the old law. The new restrictions only apply starting January 1, 2009.
That means if you bought your home before 2009 and sold it during or after 2009, then you’ll use the old law to determine your tax liability for the part before 2009, and then use the amended law to determine your tax liability for the period afterward.
I hope that doesn’t make your head want to explode.
Since the test for primary residence is whether you are physically living in the home, then any time you are NOT physically living in the home, the home is NOT considered your primary residence.
If you rent your home out, it’s not your primary residence. (However, if you just rent out 1 room, you’re still safe, but fractional depreciation rules will apply to that room.)
If you live somewhere else for part of the year, like a vacation home, then your regular home is not your primary residence while you’re away.
I don’t think the IRS will check too carefully if you are just going on vacation for 2 weeks and living in hotels, even though I think that technically means your home is not your primary residence while you’re away.
Even though the new rules around “nonqualified use” mean the $250k / $500k tax exclusion is no longer simply determined by the 2-year residency requirement, there are a few exceptions where not living in the home is nevertheless recognized by the IRS as permissible for tax exclusion purposes.
There are 2 exceptions I want to point out in particular.
First, the period between the LAST date the home is used as a primary residence and the date the home is sold is NOT considered nonqualified use.
To be clear, it’s not considered qualified use, either; it’s just not NONqualified use. Our examples later will show the significance of this distinction.
Second, any temporary absence, not exceeding 2 years, due to a change of employment, health condition, or other unforeseen circumstances also is not considered nonqualified use.
We’ll define these terms: “employment,” “health condition,” and “other unforeseen circumstances” in a moment.
If part of your ownership period consists of nonqualified use, you won’t get the full tax exclusion, even if you satisfy the 2-year residency requirement.
But you might still get a partial tax exclusion…and if the gain is large enough you might even still be able to get the full exclusion.
And remember: all this nonqualified use stuff only applies to 2009 or later. Before that, there is no such concept and therefore no restrictions on the tax exclusion.
We’ll show how all this works in our examples below.
So…if you can only claim part of the tax exclusion, exactly how much CAN you claim?
It’ll be a percentage. The way the IRS determines that percentage is by creating a fraction.
The numerator of the fraction is the total days of nonqualified use while you owned the home SINCE January 1, 2009.
The denominator is the total days you owned the home, even before 2009.
That percentage is what you CANNOT exclude from taxes. You can exclude the rest. (The percentage is applied against your actual gain amount, not the max $250k/$500k threshold.)
Okay, enough theory.
Let’s look at examples…
Let’s say Victor and Victoria, a married couple, purchase a home for $1 million and sell it for $1.6 million.
Victor and Victoria buy their home January 1, 2019. They live there as their primary residence for 2 years plus 1 day, moving out January 1, 2021.
The next day, they rent out the house to a tenant, who leases it for 2 years plus 364 days — just shy of 3 years. They sell the house December 31, 2023, exactly 5 years after buying it.
What are the tax consequences?
Since their entire ownership period occurs after 2009, only the post-2009 regime applies.
In this case, Victor and Victoria will get the full tax exclusion of $500k.
They satisfied the 2-year residency requirement because they lived in the house for 2 years and a day.
They also have a valid exception to nonqualified use because the period after the LAST date the home was used as a primary residence (January 1, 2021) is NOT considered nonqualified use.
That’s true even though they rented out the home for nearly 3 years.
So, Victor and Victoria get the first $500k gain excluded from taxes. They’ll pay long-term capital gains taxes on the final $100k of gain.
Let’s look at a similar example. Same facts as above, except here Victor and Victoria move out 1 year plus 364 days after buying and occupying the house — just shy of 2 years.
They rent out the house for the remainder of the time until they sell at the 5-year mark.
Now, our unhappy couple fails to satisfy the 2-year residency requirement.
Even though the period after they move out is still validly excepted from nonqualified use, they cannot claim any tax exclusion because they failed the 2-year residency requirement.
So they must pay long-term capital gains taxes on the entire gain of $600k. Bummer.
Getting a little more complicated, let’s say Victor and Victoria buy their home for $1 million on January 1, 2018.
They live there 1 year and move out December 31, 2018, so Victoria can accept a 1-year job rotation to a foreign branch office of her company. During their year abroad, they rent out their house.
The day after the tenant’s lease ends on December 31, 2019, they move back in. They live there for 2 more years and then move out again December 31, 2021.
They find a new tenant and start renting the house out the following day until they sell exactly 2 years later on December 31, 2023, for $1.6 million.
In this scenario, Victor and Victoria own the house for a total of 6 years.
4 discrete use periods:
- Primary residency #1 (1 year from 1/1/18 – 12/31/18)
- Move out for job rotation (1 year from 1/1/19 – 12/31/19)
- Primary residency #2 (2 years from 1/1/20 – 12/31/21)
- Move out to change things up (2 years from 1/1/22 – 12/31/23)
What are the tax consequences?
Victor and Victoria still get the full tax exclusion of $500k.
First, the IRS looks back 5 years from the sale to evaluate the 2-year residency requirement. In this case, it was satisfied.
Next, we determine that the earliest year of the lookback period, 2019, does not count as “nonqualified use,” even though Victor and Victoria weren’t living in the house, because they moved due to a job rotation which is a valid exception.
Finally, the last 2 rental years also don’t count as “nonqualified use” because of the exception after the LAST date the home is used as a primary residence. So, 2022 and 2023 will not count as “nonqualified use.”
That means, even though half the 6-year period was spent renting the house to tenants, Victor and Victoria can still claim the full exclusion because there are no periods of nonqualified use!
Victor and Victoria happily exclude the first $500k gain and then pay regular capital gains taxes on the last $100k.
What about when the house is purchased before 2009 and sold after 2009?
Same facts: Victor and Victoria buy for $1 million and sell for $1.6 million.
They buy and move in January 1, 2006. They move out 1 year later and rent out the home for the next 4 years: 2007, 2008, 2009, and 2010.
They move back in 2011 and live there exactly 1 year before accepting a job rotation overseas. For that year abroad (2012), they rent out the house.
When they return, they move back in New Year’s Day 2013 and live there for 3 years before selling at the end of 2015.
What are the tax consequences?
They’ll be able to claim 80% of the $600k tax exclusion (not 80% of the $500k max), but they’ll have to pay regular capital gains taxes on the other 20%.
First, we analyze whether they meet the residency requirement: they do. They lived in the home for 4 years: 2011, 2013, 2014, and 2015.
Next, we know their job rotation year (2012) is a valid exception to “nonqualified use” even though they rented the house out.
Since they owned the home before 2009, we ignore all rental years before then, because there is no such concept as nonqualified use before 2009.
We only analyze rental years starting 2009 — in this case 2009 and 2010.
We take the ratio of nonqualified use to the full ownership duration to compute how much gain CANNOT be excluded from taxes.
Here, the numerator is 2 years for the rental period of 2009 and 2010. (Remember, the job rotation year 2012 is a valid exception.)
The denominator is 10 years, the entire period of ownership from 2006 – 2015.
So, that tells us we cannot claim the tax exclusion on 20% of the gain, which means we can claim it on the other 80%.
Victor and Victoria can claim $480k in gain tax-free — that’s 80% of $600k. They’ll pay regular capital gains taxes on $120k, or 20% (remember, they bought at $1 million and sold at $1.6 million).
We’ve seen that satisfying the requirements lets you exclude up to $250k / $500k from taxes.
And when you have some nonqualified use, you can still exclude some gain, as long as you meet the other requirements.
But if you fail the other requirements, you generally cannot exclude any gain from taxes.
But there is an important exception: If you sell your home but don’t meet the residency requirement, or you sell within 2 years of selling another home, you MAY still be eligible for a partial exclusion IF the sale is due to a change in employment, health, or “other unforeseen circumstances.”
What qualifies as a “change in employment, health, or other unforeseen circumstances”?
The IRS has helpfully published regulations providing guidance and examples describing these scenarios. (See: “IRS Treasury Regulations Section 1.121–3.”)
Let’s take a quick look…
The IRS says a home sale counts as “due to a change in employment” if the main reason for the sale is because your employment LOCATION changed.
The regulations use something called a “safe harbor.”
A safe harbor is a simple test you use to analyze your situation; “passing” the test means the IRS automatically grants you a partial tax exclusion.
Failing the test does not mean you lose the partial exclusion. It just means the IRS doesn’t automatically grant it to you.
Maybe they’ll need more info before deciding. Or maybe they won’t and they’ll grant it to you anyway. Passing the safe harbor just “fast tracks” their analysis. But failing it doesn’t preclude you from a partial exclusion.
For job changes, the safe harbor is 50 miles.
That is, your home sale is automatically deemed to be caused by a job change if your new job location is at least 50 miles farther from your house than your old job. If you didn’t have an old job, then it’s if your new job location is at least 50 miles away from your house.
Important: That job change must occur during the time you own AND use your home as your primary residence.
It doesn’t matter if you start a brand new job, continue an old job, or are self-employed. The only thing that matters is location, the change in your commute distance.
Let’s see how it works.
Example 1: Alex is unemployed and owns a townhouse that she has owned and used as her principal residence since 2022. In 2023, before satisfying the 2-year residency requirement, Alex obtains a job that is 54 miles from her townhouse, and she sells the townhouse. Because the distance between Alex’s new place of employment and the townhouse is at least 50 miles, the sale is within the safe harbor and Alex can claim a partial exclusion.
Example 2: Bill is an Air Force officer stationed in Florida. Bill purchases a house in Florida in 2022. In May 2023, before satisfying the residency requirement, Bill moves out to take a 3-year assignment in Germany. Bill sells his house in January 2024. Because Bill’s new job in Germany is at least 50 miles farther from his house than his old Florida job was, the sale is within the safe harbor and Bill can claim a partial exclusion.
Example 3: Crystal works in her firm’s Philadelphia office. Crystal purchases a house in February 2021 that is 35 miles away from her office. In May 2022, before satisfying the residency requirement, Crystal begins an assignment in her company’s Wilmington office 72 miles away from her house, so she moves out of the house. In June 2023, Crystal is assigned to work in her firm’s London office. She sells her house in August 2023 as a result of the London assignment. The sale is not within the safe harbor because her job change from Philly to Wilmington did not increase her commute distance by 50 miles (72 – 35 = 37). It’s also not protected by the safe harbor because of the London assignment because Crystal was not living in her house as her primary residence when she moved to London. However, Crystal is STILL entitled to a partial exclusion because, under her facts and circumstances, the main reason she sold her home WAS her change in job location.
Example 4: In July 2022 Donna, who works as an emergency medicine physician, buys a condo 5 miles from her hospital and lives in it as her primary residence. In February 2023, Donna gets a job at a new hospital that is 51 miles away from her condo. Donna may be called in to work unscheduled hours and, when called, must be able to arrive at work quickly. Because of the demands of her new job, Donna sells her condo and buys a townhouse 4 miles away from her new hospital. Because Donna’s new job is only 46 miles farther from her condo than her old job, the sale is not protected by the safe harbor. However, Donna can still claim a partial exclusion because, under her facts and circumstances, the main reason she sold her condo was her job change.
As you can see, the safe harbor guarantees the partial exclusion, but its absence does not preclude the exclusion. It just means you have to look at the facts and circumstances.
What about changes in health?
Basically, you get a partial tax exclusion even when you don’t satisfy the residency requirement if the main reason you sold your home was to get medical care for an actual illness or injury that you or a family member have.
Actually, it’s whenever ANY “qualified individual” has an illness or injury, but if you read the rules that usually just means you and your family. (See Treasury Regulations Section 1.121–3(f) for the full run-down.)
Remember, it has to be an ACTUAL illness or injury. If it’s simply beneficial for your family’s health and well-being, you can’t claim the tax exclusion.
Just like with job changes, the health exception also has a “safe harbor” test.
It’s a physician’s recommendation.
That is, a home sale is automatically deemed to be caused by a health condition if a licensed physician recommends that you move to get medical care. You should get your doctor’s recommendation in WRITING to avoid any surprises.
Let’s look at some examples.
Example 1: In 2022, April buys a house and uses it as her primary residence. Then April is injured in an accident and unable to care for herself. April sells her house in 2023 and moves in with her daughter so that her daughter can care for her due to her injury. Under the facts and circumstances, the main reason for selling April’s home is her health, so April is entitled to claim a partial exclusion.
Example 2: Hank’s father has a chronic disease. In 2022, Hank and Wendy purchase a house together and use it as their primary residence. In 2023 they sell the house to move in with Hank’s father so they can care for him as a result of his disease. Since the primary reason for selling their home is for the health of Hank’s father, they are entitled to claim a partial tax exclusion.
Example 3: John and Linda purchase a house in 2022 and use it as their primary residence. Their son suffers from a chronic illness requiring regular medical care. Later that year their son begins a new treatment that is available at a hospital 100 miles away from home. In 2023, John and Linda sell their house in order to be closer to the hospital treating their son. Since the main reason for the sale is to treat their son’s illness, they are entitled to claim a partial tax exclusion.
Example 4: Ben, who has chronic asthma, purchases a house in Minnesota in 2022 that he uses as his primary residence. Ben’s doctor tells Ben that moving to a warm, dry climate would mitigate his asthma symptoms. In 2023, Ben sells his house and moves to Arizona to relieve his asthma symptoms. The sale is protected by the safe harbor so Ben is entitled to a partial tax exclusion.
Example 5: In 2022 Jill and Robert purchase a house in Michigan which they use as their primary residence. Robert’s doctor tells Robert he should get more outdoor exercise, but Robert is not suffering from any disease that can be treated or mitigated by outdoor exercise. In 2023 Jill and Robert sell their house and move to Florida so that Robert can increase his general level of exercise by playing golf year-round. Because the home sale is merely beneficial to Robert’s health, it is not a valid exception and Jill and Robert cannot claim a partial tax exclusion.
All right, what’s the deal with “other unforeseen circumstances”?
Unforeseen circumstances are situations where your house is sold or exchanged due to something not reasonably anticipated and not in your control.
If the main reason for selling your house is simply due to “buyer’s remorse” or due to an unexpected improvement in your financial situation, it won’t qualify for a partial exclusion.
Just as with job changes and health conditions, “other unforeseen circumstances” also has a “safe harbor” test.
The safe harbor kicks in if ANY of the following happens while you own and live in your home:
- Involuntary conversion
- Natural or man-made disaster, war, or terrorism causing damage or destruction to your home
- Death of you or a family member
- Job loss making you or a family member eligible for unemployment benefits
- Change in employment status (e.g., reduced hours or pay) that makes you unable to pay housing costs and basic expenses (e.g., food, clothes, medical, taxes, transportation)
- Divorce or legal separation
- Multiple births resulting from the same pregnancy
The IRS may define other events as “unforeseen circumstances” as well, but they’ll do that case by case, and when that happens they’ll publish written announcements explaining whether those events are generally applicable to everyone.
Let’s walk through some examples.
Example 1: In 2022 Alice buys a house in California and moves in. Shortly afterward, an earthquake causes damage to her house. Alice sells the house in 2023. The sale is protected by the safe harbor and Alice can claim a partial tax exclusion.
Example 2: Henry works as a teacher and Whitney works as a pilot. In 2022 they buy a house to live in as their primary residence. Later that year Whitney is furloughed from her job for 6 months. The couple is unable to pay their mortgage and basic living expenses while Whitney is furloughed. They sell their house in 2023. The sale is within the safe harbor and they can claim a partial exclusion.
Example 3: In 2022, Howard and Winnie buy a 2-bed condo to use as their primary residence. In 2023 Winnie gives birth to twins and the couple sells their condo to buy a 4-bed house. The sale is protected by the safe harbor and Howard and Winnie may claim a partial tax exclusion.
Example 4: In 2022 Bruce buys a high-rise condo unit and uses it as his primary residence. His monthly condo fee is $400. But 3 months after moving in, Bruce’s condo association replaces the building’s roof and heating system. Six months later, Bruce’s condo fee doubles as a result of the repairs. Bruce sells the condo in 2023 because he can’t afford both the new condo fee and his monthly mortgage. The safe harbor does NOT apply, even though Bruce can no longer afford his housing costs. However, under the facts and circumstances, the main reason for his sale, i.e., doubling the condo fee, is an unforeseen circumstance because Bruce could not reasonably have anticipated the fee would double when he bought the unit. Consequently, the sale is due to unforeseen circumstances and Bruce may claim a partial exclusion.
Example 5: In 2022 Chris buys a house as his primary residence. The house is located on a heavily traveled road. Chris sells the house in 2023 because he is bothered by the traffic noise. The safe harbor does not apply. Because the main reason for the sale is traffic noise it is not an unforeseen circumstance and Chris cannot claim a partial exclusion.
Example 6: In 2022 Diana and her fiance Eliot buy a house to live in as their primary residence. In 2023 they cancel their wedding plans and Eliot moves out. Diana cannot afford the monthly mortgage by herself, so they sell the house in 2023. The safe harbor does not apply. However, under the facts and circumstances, the main reason for the sale, the broken engagement, is an unforeseen circumstance because Diana and Eliot could not reasonably have anticipated it when they bought the house. Therefore, they are each entitled to a partial tax exclusion.
Example 7: In 2022 Frances buys a small condo as her primary residence. In 2023 she gets a promotion and a large salary increase. She sells her condo and buys a house because now she can afford it. The safe harbor does not apply. The main reason for the sale, the salary increase, is an improvement in Frances’s financial circumstances. An financial improvement, even if due to unforeseen circumstances, does not qualify for partial tax exclusion.
Example 8: In April 2022 George buys a house to use as his primary residence. He sells the house in October 2023 because it has greatly appreciated in value, mortgage rates have declined, and he can now afford a bigger house. The safe harbor does not apply. The main reasons for the sale, the change in house value and mortgage rates, are a financial improvement, so George does not qualify for a partial exclusion due to unforeseen circumstances.
Example 9: Hudson works as a police officer. In 2022 he buys a condo to use as his primary residence. In 2023 he is assigned to the city’s K–9 unit and is required to care for his police service dog at his home. Because Hudson’s condo association does not permit dog ownership, Hudson sells the condo in 2023 and buys a house. The safe harbor does not apply. However, under the facts and circumstances, the reason for the sale, Hudson’s assignment to the K–9 unit, is an unforeseen circumstance because Hudson could not reasonably have anticipated this at the time he purchased the condo. Consequently, Hudson may claim a partial exclusion.
Example 10: In 2022, Jennifer buys a small house to use as her primary residence. Jennifer wins the lottery in 2023 and sells her house to buy a bigger, more expensive house. The safe harbor does not apply. The main reason for the sale is a financial improvement and does not qualify for a partial tax exclusion.
It’s a percentage.
Here, the IRS will multiply the maximum allowed exclusion (i.e., $250k / $500k) by a fraction.
The numerator is the lower of EITHER…
- (a) the duration the home was owned AND used as the taxpayer’s primary residence (looking back 5 years from the sale), OR
- (b) the duration from the taxpayer’s most recent prior sale for which capital gain was excluded under Section 121 to the date of the current sale
The denominator is: 2 years.
The numerator and denominator must use the same unit of time, so if you’re using days for one you also have to use days for the other; if you use months for one, you must use months for the other.
Let’s look at some examples.
Example 1: On January 1, 2021, Monica buys a home for use as her primary residence. 18 months later on July 1, 2022, she sells the home because her job gets transferred to another state. Monica may exclude up to $187,500 of gain from taxes: that’s $250k * 18 months / 24 months.
Example 2: On January 1, 2020, Jordan buys a house as his primary residence. On January 1, 2022, Jordan marries Holly and she moves in. On January 1, 2023 (12 months after Holly moves in), they sell the house due to a valid job change. Because only Jordan has satisfied the 2-year residency requirement, the couple cannot get the full $500k tax exclusion. Instead, their exclusion will be determined by calculating what each person would get had they not been married. Jordan can exclude his full $250k gain because he satisfies the residency requirement. Although Holly does not satisfy the residency requirement, but she can claim a partial exclusion due to the job change. She can exclude up to $125k, which is $250k * 12 months / 24 months. Therefore, the couple can claim a combined exclusion of $375k.
Notice one VERY important detail: Partial exclusions when you FAIL to meet the residency requirements are calculated by multiplying the appropriate fraction by the MAXIMUM permitted exclusion of $250k / $500k, and NOT by the ACTUAL realized gain.
In reality, then, getting a partial exclusion when you FAIL the residency requirement quite often means you can still end up excluding the ACTUAL entire gain from your home sale! That is true if your actual gain falls short of the maximum permitted exclusion.
In fact, if your actual gain is as shown below, you’ll still be able to exclude the full amount if you FAIL the residency requirement as long as your partial exclusion percentage is the corresponding amount:
By contrast, getting a partial exclusion when you PASS the residency requirement means you will definitely exclude LESS than your ACTUAL gain. That’s because the fraction (1 – post-2009 nonqualified use / total ownership duration) is applied against your ACTUAL gain, not the MAXIMUM permitted gain of $250k / $500k.
So if your actual gain is, say, $100k when you PASS the residency requirement, you’ll only get to exclude a fraction of that if you have ANY nonqualified use. Whereas if your actual gain is $100k when you FAIL the residency requirement, you can still exclude all of it as long as your applicable fraction is at least 40% if you’re a single filer ($100k / $250k) and 20% if you’re a joint married filer ($100k / $500k).
Is your mind blown yet?
What the IRS is incentivizing with this is maneuvers to AVOID the residency requirement while creating a valid exception to still get a partial exclusion.
One last thing on calculating the partial exclusion amount.
If the taxpayer acquires a replacement home following a home conversion qualifying for a partial exclusion, the ownership and residency period carries over to that replacement home if the replacement home’s cost basis is determined using the involuntary conversion rules of Section 1033(b) of the Internal Revenue Code.
Example: On January 1, 2013, Sean buys a house as his primary residence that costs $200k. On January 1, 2023, a tornado destroys his house. Sean gets $550k from his insurance company. The destruction of his house qualifies for gain exclusion under both Section 121 and Section 1033.
Sean then buys a new house for $280k. Because he can exclude up to $250k of gain from taxes, for purposes of Section 1033, the amount realized is “adjusted” to $300k ($550k insurance proceeds less $250k exclusion) and the taxable portion of that is $100k ($300k “adjusted” amount realized less $200k original home cost basis).
Since Sean bought a replacement home for $280k, he recognizes gain of $20k and pays taxes on it now ($300k “adjusted” amount realized less $280k replacement home cost). The remaining $80k is tax-deferred ($100k taxable gain less $20k already taxed). The cost basis of the replacement home is $200k ($280k cost less $80k deferred gain). And Sean’s 10-year ownership and residency period from the original house carries over to his replacement house.
There’s a couple issues open to interpretation about the exceptions for job changes, health, and unforeseen circumstances.
One is whether the same safe harbor tests that apply to partial exclusions when you FAIL the residency requirement also apply to the nonqualified use exceptions when you PASS the residency requirement.
It seems reasonable that they would, but the Treasury Regulations Section 1.121–3 don’t explicitly confirm this.
The regulations were written to address cases where you fail the residency requirement. But the nonqualified use exceptions came later and only went into effect in 2009 — years after the regulations were already published.
Absent explicit IRS guidance to the contrary, I recommend you assume the same safe harbor tests apply in both cases.
Second is the nonqualified use exception that grants leniency for temporary absences not exceeding 2 years due to job change, health condition, or other unforeseen circumstances.
It’s not entirely clear what happens when an absence due to one of these reasons lasts LONGER than 2 years.
If you have a health condition that requires you to live away for 2 years plus 1 day, does that mean the first 2 years are validly excepted from nonqualified use while the last 1 day counts as nonqualified use? Or does it mean zero days are now validly excepted and therefore you cannot claim this exception at ALL?
I haven’t seen clear IRS guidance on this, so it’s something to discuss with your tax advisor.
One other thing you should know is how Section 121 interacts with depreciation recapture.
Depreciation recapture is where the IRS taxes you when you sell your home for any cost basis you depreciated while owning your home.
Typically, you’ll depreciate your cost basis (property value only, not land value) when you rent out the home to a tenant. This helps offset your rental income which in turn lowers your tax liability.
You’ll typically depreciate using a straight-line method over a 27.5-year horizon. Your cost basis declines correspondingly with each depreciation deduction.
Incidentally, you should ALWAYS take the depreciation deduction.
Don’t think you’ll “save your cost basis” and avoid depreciation recapture by simply forfeiting the depreciation deduction.
When you sell your home, the IRS automatically assumes you have taken the depreciation deduction to its maximum extent for the entire period you rented out the property.
So the IRS taxes you on depreciation recapture whether you actually took the depreciation deduction or not. There is no way to avoid this. So you should ALWAYS take the depreciation deduction and find income to offset it against.
Google any of this if it’s news to you.
Anyway, when you sell the home, the IRS will tax you on any amounts you depreciated if your sale price exceeds your depreciated cost basis.
The IRS will tax you a flat 25% on depreciation recapture, regardless of your ordinary income tax bracket.
Any capital gains above and beyond the depreciation recapture is taxed at normal capital gains rates, typically the long-term rate of 15% (or zero if you satisfy the requirements of Section 121).
What you have to know about how Section 121 interacts with depreciation recapture is that Section 121 exclusions and limitations never apply to depreciation recapture.
Section 121 simply ignores depreciation recapture and focuses solely on pure capital gains.
A quick example:
Say you buy a house for $100k. $40k is property value; $60k is land value.
You live there for 2 years. Then you rent it out for 2 years. You make no major improvements during that time. In each of those 2 rental years you should depreciate $1,454.55 of the $40k property value and deduct that from your rental income. $1,454.55 = $40k / 27.5 years.
At the end of 4 years you sell the house for $250k. Your cost basis now is $97,091 = $100k – ($1,454.55 * 2).
You will pay 25% tax on the difference between your original cost basis of $100k and your current cost basis of $97,091, so you’ll pay 25% tax on $2,909 REGARDLESS of what Section 121 says.
Then, having satisfied all the requirements of Section 121, you’ll pay zero taxes on the next $150k of gain, which is the difference between your original cost basis of $100k and the sale price of $250k.
Section 121 won’t help you with depreciation recapture even though you’re still well under the $250k exclusion cap.
All right, big post…and we’re curious what you have to say!
What other tips or strategies do you use to do tax planning for your home?
Let us know in the comments below!
Plus: Interested in building massive wealth with real estate?
Then be sure to check out my real estate house hacking posts, which explain step by step how we’re creating real estate wealth by having others pay our mortgage on multi-million dollar real estate.