Hi @markmacchioni – We’ve got a great write-up on this topic here, and it includes a link to the IRS doc that details exceptions to the rules. (That is, there are some situations, even if you sell your house early, where you might still get a partial capital-gains-tax exemption.)
Given how valuable this tax break can be, I’d highly recommend consulting with a tax professional who has expertise in this area.
I will note that in the IRS rules, there are a few references to “24 months” and even one reference to a specific number of days, which seems to suggest that homeowners might have to monitor the dates fairly closely. I copied the text below from this IRS doc:
Eligibility Step 2—Ownership
Determine whether you meet the ownership requirement.
If you owned the home for at least 24 months (2 years) out of the last 5 years leading up to the date of sale (date of the closing), you meet the ownership requirement. For a married couple filing jointly, only one spouse has to meet the ownership requirement.
Eligibility Step 3—Residence
Determine whether you meet the residence requirement.
If you owned the home and used it as your residence for at least 24 months of the previous 5 years, you meet the residence requirement. The 24 months of residence can fall anywhere within the 5-year period, and it doesn’t have to be a single block of time. All that is required is a total of 24 months (730 days) of residence during the 5-year period. Unlike the ownership requirement, each spouse must meet the residence requirement individually for a married couple filing jointly to get the full exclusion.