Section 121 excludes up to $250k single or $500k MFJ of home-sale gain if you owned and lived there 2 of the last 5 years. The gain math, partial exclusions, and rental traps explained.
Sell your main home and up to $250,000 of gain — $500,000 if married filing jointly — is simply tax-free, under Section 121 of the tax code. The test is short: you must have owned the home and used it as your principal residence for at least 2 of the 5 years ending on the sale date. Pass it, and for most families the entire profit disappears from the tax return. No age requirement, no rollover into a new house, no once-in-a-lifetime limit — you can use it repeatedly, generally once every two years.
A home sale is usually the largest single gain most people ever realize, and it often travels with other big changes — a new city, a marriage, a growing family — which is why it anchors a section of our life-events tax guide. Below: how the 2-of-5 test works, how to compute the gain correctly (basis is where people overpay), the partial exclusion when life forces an early sale, and the rental-conversion traps.

Both requirements — ownership and use — must be met for 24 months (730 days) within the 5 years before closing, but the months don't have to be continuous and the two tests don't have to overlap. Live in a home for two years, rent it out for up to three, then sell: still qualified. A few clarifications that answer most real-world questions:

Your taxable gain is the amount realized minus your adjusted basis, and both ends are adjustable in your favor:
Worked example. A couple bought for $400,000, spent $80,000 on improvements over fifteen years, and sells for $1,050,000 with $60,000 of selling costs. Amount realized: $990,000. Adjusted basis: $480,000. Gain: $510,000 — of which $500,000 is excluded, leaving just $10,000 of taxable long-term gain. Without the improvement records, the gain would be $590,000 and the taxable slice $90,000. That's why the single best habit of homeownership is a folder (digital is fine) of every improvement receipt, kept for as long as you own the home plus three years.
Whatever gain survives the exclusion is a long-term capital gain, taxed at capital-gains rates — and depending on your other income that year, some of it may even land in the 0% bracket, a possibility worth timing for, as we explain in our guide to the 0% capital gains bracket. Large surviving gains can also attract the 3.8% net investment income tax above $200,000 single / $250,000 MFJ MAGI.

Fail the two-year test and you don't automatically lose everything. If the primary reason for the early sale is a change in place of employment, health, or certain unforeseen circumstances (divorce, multiple births, a death in the family, and similar events), you get a pro-rated exclusion — and note carefully: it's the exclusion cap that gets prorated, not your gain.
Example: a single owner lives in a home 12 months, then a job relocation forces a sale. Twelve months is half of the required 24, so the cap becomes half of $250,000 = $125,000. If the gain is $70,000, the entire gain is still excluded — the prorated cap only bites if your gain exceeds it. For most short-tenure sales with a qualifying reason, the partial exclusion wipes out the whole gain. The job-change trigger has a working rule of thumb: a new job location substantially farther from the home than the old one generally qualifies. If you're selling early because of a move, the state-tax side of that move has its own rules — see our guide to moving states mid-year.
The exclusion gets complicated when the home hasn't been purely your residence:
If any of these apply, this is a return worth professional preparation — the interaction of recapture, nonqualified use, and the exclusion is where DIY filings go wrong.
If your entire gain is excluded and you receive no Form 1099-S from the closing agent, the sale generally doesn't need to appear on your return at all. If a 1099-S was issued (title companies often issue them routinely), report the sale on Form 8949 and Schedule D and claim the exclusion there — otherwise the IRS computer sees gross proceeds with no return entry and sends a mismatch notice. And any gain above the exclusion is reportable regardless. Losses on a personal residence, for the record, are never deductible.
Own and live in your home for 2 of the last 5 years and Section 121 excludes up to $250,000/$500,000 of gain; keep improvement receipts to shrink whatever's left; claim the pro-rated exclusion if a job, health, or unforeseen event forces an early sale; and watch for depreciation recapture the moment a rental history enters the picture. Taxagon's CPAs and EAs handle home-sale reporting and exclusion planning for individual clients every season — if your sale has a wrinkle, reach out before you close.
This article is general information, not tax advice for your specific situation. Tax law changes; figures are for the years stated.
Talk it through with a licensed US tax professional — we'll tell you honestly whether it applies to your situation.

Getting married, having a baby, moving states, or buying and selling a home all rewrite your tax return. Here's what changes at each event and the paperwork to update within 30 days.

Joint filing wins on rates for most couples, but separate can win with income-driven student loans, a spouse's tax problems, or liability risk. Here's the real decision framework.

Move states mid-year and you'll file two part-year returns, split income by earning period, and possibly fight your old state over domicile. Here's the checklist that makes the move stick.