Heavenly Finance Email updates

Taxes in retirement · Guide

A house held for forty years has a gain. The date of a spouse's death can change what escapes it.

Federal law excludes a large slice of the gain on a main home from income altogether. The two year test, the window that keeps the larger amount alive after a death, the provision written for a move into residential care, and the partial exclusion almost everyone reads backwards.

Jump to section · 9 parts
  1. A house held for forty years has a gain. The date of a spouse's death can change what escapes it.
  2. Two hundred and fifty thousand, five hundred thousand, and what the larger one requires
  3. The two year window after a spouse dies
  4. The adjustment that often makes the exclusion unnecessary
  5. A move into a care facility does not break the test
  6. Falling short of two years is not all or nothing
  7. The parts of the gain the exclusion does not reach
  8. The one afternoon checklist
  9. Where these rules come from

Part 1

A house held for forty years has a gain. The date of a spouse's death can change what escapes it.

A house bought decades ago and sold now has a gain, and the gain is often far larger than the household expects, because it is measured against what was paid rather than against anything that feels like recent value.

Federal tax law then does something unusual with that gain. It does not tax it at a lower rate. It excludes it from gross income entirely, up to a limit, where a set of conditions is met.

The core rule is one sentence. Gross income does not include gain from the sale of property if, during the five year period ending on the date of the sale, the property was owned and used as the taxpayer's principal residence for periods aggregating two years or more.

Three things about that sentence are worth noticing straight away. The two years do not have to be consecutive, because the test is periods aggregating two years. They do not have to be the most recent two, because the window is the whole five years. And ownership and use are separate requirements that both have to be satisfied, though not necessarily at the same moments.

These are federal rules and they apply the same way in every state. One important rule described in Part 4 is federal but depends on state property law for its result, and that is flagged where it arises. This guide is educational information. It is not legal, tax or financial advice, and it does not tell anyone when to sell anything.

Part 2

Two hundred and fifty thousand, five hundred thousand, and what the larger one requires

The excluded amount is capped. For a single filer the cap is $250,000 of gain. On a joint return it can be $500,000, but only where three conditions all hold.

  • Either spouse meets the ownership requirement.
  • Both spouses meet the use requirement.
  • Neither spouse is disqualified by having used the exclusion on another sale within the last two years.

The asymmetry in the first two lines is the whole design. Ownership can sit with one spouse alone, which covers a house that was never retitled after a marriage. Use cannot: both people have to have lived there for the required period.

What happens when the three are not all met

Failing them does not drop a couple to the single figure. Federal law says the limit is then the sum of what each spouse would have been entitled to had they not been married, and for that purpose each is treated as owning the property during any period either of them owned it. Depending on which spouse meets which test, that lands somewhere between the two headline figures rather than automatically at the lower one.

The once every two years limit

The exclusion is not available at all where, during the two year period ending on the date of the sale, there was another sale to which it applied. It is a limit on frequency rather than a lifetime allowance, and it resets.

Two more structural points. The exclusion applies automatically: federal law says the section applies unless the taxpayer elects for it not to, so it is not something that has to be claimed to exist.

And ownership periods can be inherited in one other situation. Where a home was transferred between spouses or former spouses in a transfer that federal law treats as tax-free, the recipient's ownership period includes the transferor's, which matters where a house changed hands on a divorce.

Part 3

The two year window after a spouse dies

The $500,000 amount belongs to a joint return. A surviving spouse filing alone would ordinarily be back to $250,000, and for a long-held house that difference can be the entire tax.

Federal law provides for this directly. Where an unmarried individual whose spouse is deceased sells the property, the $250,000 figure is replaced by $500,000 if two conditions hold:

  • The sale occurs not later than two years after the date of death of the spouse.
  • The conditions for the joint amount were met immediately before that date of death.

Both are worth reading twice. The clock runs from the date of death rather than from any tax year, and it is a hard two years. And the qualifying test looks backwards to the position just before the death, so a house the couple had both lived in and one of them had owned qualifies even though the survivor could never have satisfied the joint test alone afterwards.

A second provision, with no deadline on it at all

The rule above fixes the amount. It does nothing about the ownership and use test, and for a survivor who was never on the deed that test is the harder problem.

A separate provision solves it. For an unmarried individual whose spouse has died, the period that individual owned and used the property includes the period the deceased spouse owned and used it before death. A widow or widower therefore inherits their spouse's years for the purpose of the two year test.

This part of the guide is a description of a deadline that exists in federal law, and it is set out because a household that does not know about it cannot take it into account. It is not a suggestion about when to sell a house after a death. That decision belongs to the household and to whoever advises them, and it turns on far more than tax.

Part 4

The adjustment that often makes the exclusion unnecessary

Gain is the sale price less the basis, and basis is usually what was paid. There is a major federal exception. The basis of property acquired from a person who has died is, as a general rule, the fair market value at the date of death.

As a general rule, because the statute opens by excepting other provisions of the same section, and two of them can put a different figure in place: an election to value the estate at an alternate date, and a special valuation available to some farm and closely held business property. Where either was made, the operative figure is not the date of death value.

For a couple who bought a house in 1972 and where one has now died, the effect is large. The deceased spouse's share of the house takes a new basis at date of death value. Only the survivor's own share still carries the original cost, so the gain on a later sale is measured from a much higher figure than the purchase price.

Where the state changes the federal answer

How much of the house gets that new basis depends on state property law, and the difference is stark.

Where the property was heldWhat takes the date of death value
Most statesThe deceased spouse's share only. The survivor's share keeps its original cost basis.
Community property, under the law of a state that has itBoth halves. Federal law treats the surviving spouse's own one-half share of community property as acquired from the decedent, where at least half of the community interest was includible in the deceased's gross estate.

The one case where the new basis does not arrive

The adjustment is not unconditional. Where appreciated property was given to the person who died during the year ending on the date of their death, and it then passes back to the donor or the donor's spouse, the basis is the deceased person's adjusted basis rather than the date of death value. The step-up is switched off.

That rule exists to stop a transfer made purely to collect a new basis, and it is worth knowing about wherever property changed hands within the last year of someone's life.

The practical consequence is that many households discover the exclusion never had to do much work. The new basis absorbed most of the gain and the exclusion covered the rest.

Part 5

A move into a care facility does not break the test

Consider a person who moved into a nursing home four years ago. The house has stood empty or been let. On the face of the main rule they have not used it as a principal residence for two of the last five years, and the exclusion is gone.

Federal law says otherwise, in a provision written for exactly this situation. Where a taxpayer becomes physically or mentally incapable of self-care, and owned and used the property as a principal residence for periods aggregating at least one year during the five year period, that person is treated as using the property as their principal residence during any time in that five year period in which they own it and reside in a facility licensed by a state or political subdivision to care for someone in their condition.

The four conditions inside that sentence

  • The person became physically or mentally incapable of self-care. It is a condition about capacity, not about age or about having moved.
  • They owned and used the home as a principal residence for at least one year within the five year window, rather than the usual two.
  • They continue to own the property while in the facility.
  • The facility is licensed by a state or political subdivision to care for someone in that condition.

The provision converts what looks like a lost exclusion into a live one, and it does so for a group of households facing exactly the costs that make it matter.

Part 6

Falling short of two years is not all or nothing

Where the two year test is not met, or where the once every two years limit would otherwise bite, federal law provides a reduced exclusion in defined circumstances. The sale has to be by reason of a change in place of employment, health, or, to the extent provided in regulations, unforeseen circumstances.

What happens then is stated precisely in the statute, and it is not what most summaries say. The ownership and use requirements do not apply at all. Instead the dollar limitation is reduced, in the same ratio that the period actually owned and used bears to two years.

Why the difference is the whole point

Consider someone who lived in a home for one year of the required two and has a gain of $180,000.

  • Read as a fraction of the gain, half of $180,000 would be excluded and $90,000 would be taxable.
  • Read as a fraction of the limit, which is what the statute says, the cap becomes half of $250,000, or $125,000. The gain exceeds that cap, so $125,000 is excluded and $55,000 remains.

On smaller gains the difference is starker still. A gain of $100,000 with a halved limit of $125,000 is excluded in full, where the fraction-of-the-gain reading would have taxed half of it.

Part 7

The parts of the gain the exclusion does not reach

The exclusion is broad and it is not total. Two portions of gain fall outside it.

Depreciation already taken

Where the property was let or used for business and depreciation was claimed, the exclusion does not apply to gain up to the amount of the depreciation adjustments attributable to periods after May 6, 1997. That slice of gain is taxed however long the house was afterwards lived in.

It is also taxed differently from the rest. That slice is what the code calls unrecaptured section 1250 gain, and federal law applies a rate of up to 25 percent to it rather than the lower long term capital gain rates that apply to the remainder. A household expecting the whole gain to be taxed at one rate will be reading the wrong number.

Periods of nonqualified use

Separately, gain allocated to periods of nonqualified use is excluded from the exclusion. A period of nonqualified use is one in which the property was not the principal residence of the taxpayer or their spouse, and only periods after January 1, 2009 count.

The exceptions to that definition matter more than the definition:

  • Any part of the five year window after the last date the property was used as a principal residence is not nonqualified use. Moving out and letting the house for a year or two before selling therefore does not create nonqualified use at all.
  • Periods of qualified official extended duty, up to an aggregate of ten years. That is a narrow category rather than a general one for people posted elsewhere for work: it reaches a member of the uniformed services, a member of the Foreign Service, or an employee of the intelligence community, serving at a duty station at least fifty miles from the property or living under government orders in government quarters.
  • Any other temporary absence, up to an aggregate of two years, due to a change of employment, health conditions, or other unforeseen circumstances specified by the Treasury.

What gain outside the exclusion can set off elsewhere

Two consequences reach beyond the tax on the sale itself, and both are driven by gain that is not excluded.

  • Gain outside the exclusion is generally net investment income, and federal law adds a further 3.8 percent tax on it above a threshold amount. Those thresholds are $250,000 for a joint return or a surviving spouse as the code defines that term, and $200,000 in any other case. Unusually, they are not adjusted for inflation, so they have stayed where they were set. Generally, because gain on property held in a trade or business that is not a passive activity falls outside net investment income, which is a question for anyone whose property was more than a home.
  • The same income figure is what sets a Medicare premium surcharge two years later. A one-off gain in one year can raise Part B and Part D premiums in a later one, for a household whose income has already gone back to normal. The library's guide on the Medicare income surcharge covers how that is calculated and the life-changing event route for asking it to be reconsidered.

Part 8

The one afternoon checklist

Almost all of this is dates and documents, and every one of them is easier to establish before a sale than after one.

  • Work out the gain rather than the price: sale proceeds less basis. The cap applies to the gain alone.
  • Count the months the property was owned, and separately the months it was used as a main home, inside the five years ending on the expected sale date. They do not have to be the same months or be consecutive.
  • If a spouse has died, write down the date. The larger amount is available on a sale no later than two years after it, and only while the survivor is unmarried.
  • Separately from that deadline, count the deceased spouse's years of ownership and use as your own. That rule has no time limit and it is what carries a survivor over the two year test.
  • If a spouse has died, find or obtain a valuation of the house as at that date. It normally sets the new basis and is far harder to establish later. Ask separately whether an alternate or special valuation was elected for the estate, because either displaces that figure.
  • Ask whether the property was held as community property under the law of the state. In a community property state both halves can take the date of death value rather than one.
  • If the owner moved into residential care, check that the facility is licensed by the state or a political subdivision, and that the home was owned and lived in for at least a year within the five year window.
  • Note any sale of another home in the two years before this one to which the exclusion was applied. It disqualifies the ordinary exclusion.
  • If the two year test cannot be met, identify whether the sale is by reason of a change in place of employment, health, or unforeseen circumstances. That is the gateway to the reduced exclusion.
  • Total any depreciation claimed on the property for periods after May 6, 1997. That much gain is outside the exclusion.
  • List any period after January 1, 2009 when the house was not a main home for either spouse, other than the period after it stopped being one for good.
  • Check whether the property was ever acquired in a like-kind exchange. A sale within five years of that acquisition is barred from the exclusion outright.
  • Work out whether gain outside the exclusion would cross $250,000 on a joint return or $200,000 otherwise, which is where the additional 3.8 percent tax begins.
  • Expect the year of sale to set Medicare premiums two years later, and ask a preparer whether an estimated payment is needed in the year of the sale itself.

Part 9

Where these rules come from

The exclusion, and the ownership and use test of two years aggregating within a five year window
26 U.S.C. 121(a). Retrieved September 5, 2026.

The $250,000 cap, the $500,000 joint amount and its three conditions, and the once every two years limit
26 U.S.C. 121(b)(1), (b)(2)(A) and (b)(3). Retrieved September 5, 2026.

The larger amount for an unmarried surviving spouse on a sale within two years of the death, where the joint conditions were met immediately before it
26 U.S.C. 121(b)(4). Retrieved September 5, 2026.

A surviving unmarried individual counts the deceased spouse's period of ownership and use, with no time limit on that rule
26 U.S.C. 121(d)(2). Retrieved September 5, 2026.

Property transferred between spouses or former spouses tacks the transferor's ownership period
26 U.S.C. 121(d)(3)(A). Retrieved September 5, 2026.

No exclusion at all on a sale within five years of acquiring the property in a like-kind exchange
26 U.S.C. 121(d)(10). Retrieved September 5, 2026.

No new basis where appreciated property was given to the decedent within a year of death and passes back to the donor or their spouse
26 U.S.C. 1014(e). Retrieved September 5, 2026.

Unrecaptured section 1250 gain is taxed at a rate of up to 25 percent
26 U.S.C. 1(h)(1)(E). Retrieved September 5, 2026.

The additional 3.8 percent tax on net investment income, and the threshold amounts of $250,000 and $200,000
26 U.S.C. 1411(a) and (b). Retrieved September 5, 2026.

Nonqualified use after January 1, 2009, and the exceptions including the period after the property last served as a principal residence
26 U.S.C. 121(b)(5). Retrieved September 5, 2026.

The reduced exclusion, which reduces the dollar limitation rather than apportioning the gain, and the three circumstances that open it
26 U.S.C. 121(c)(1) and (c)(2). Retrieved September 5, 2026.

Gain up to the depreciation adjustments for periods after May 6, 1997 is not excluded
26 U.S.C. 121(d)(6). Retrieved September 5, 2026.

Determination of use during periods of out-of-residence care, the one year requirement, and the state licensed facility condition
26 U.S.C. 121(d)(7). Retrieved September 5, 2026.

The section applies unless the taxpayer elects for it not to
26 U.S.C. 121(f). Retrieved September 5, 2026.

Where the three joint conditions are not met, the limit is the sum of what each spouse would have been entitled to unmarried
26 U.S.C. 121(b)(2)(B). Retrieved September 5, 2026.

Qualified official extended duty, and the three classes of person it reaches
26 U.S.C. 121(d)(9). Retrieved September 5, 2026.

Basis of property acquired from a decedent is the fair market value at the date of death, except as otherwise provided including the alternate and special valuation elections
26 U.S.C. 1014(a)(1). Retrieved September 5, 2026.

The surviving spouse's own half of community property is treated as acquired from the decedent
26 U.S.C. 1014(b)(6). Retrieved September 5, 2026.

This guide is educational information. It is not legal, tax or financial advice.

Update history

September 5, 2026
First published.

About Heavenly Finance

Heavenly Finance publishes guides on the money decisions that are easiest to get wrong: Medicare, Social Security, wills and estates, taxes in retirement, fraud and everyday money. Every figure traces to the agency page, statute or regulation it came from, with the date it was checked. How the guides are written and checked · Report an error