How the Section 121 exclusion actually works
When you sell your primary residence, the IRS lets you exclude up to $250,000 of gain from federal tax — $500,000 if you're married filing jointly — under Section 121 of the tax code. To qualify, you must have owned the home and used it as your main home for at least 2 of the 5 years before the sale. The two years don't need to be continuous, and you can use the exclusion repeatedly, but not more than once every two years.
Your gain isn't just sale price minus purchase price. It's the amount realized (sale price minus selling costs like commission) minus your adjusted basis (purchase price, plus capital improvements like a new roof or addition, minus any depreciation claimed). Getting the basis right is where most people either overpay or under-report — keep records of every improvement.
If you ever rented the property
Depreciation claimed during rental years is never excludable under Section 121. On sale, it comes back as "unrecaptured Section 1250 gain," taxed at up to 25% — separately from the long-term capital gains rate on the rest of your gain. This surprises a lot of sellers who converted a rental back into a residence, and it applies even if you were entitled to depreciation but never claimed it.
The 3.8% NIIT layer
Gain excluded under Section 121 is not investment income and never triggers the Net Investment Income Tax. But taxable gain above the exclusion does, if your modified AGI exceeds $200,000 (single) or $250,000 (married filing jointly). On a large gain, this quietly adds 3.8% on top of your capital gains rate.
What this calculator doesn't model
Honesty about scope: this estimates federal tax only. It doesn't include state capital gains tax, the "non-qualified use" proration for homes converted from a rental into a residence after 2008, installment sales, or 1031 exchanges (which don't apply to primary residences anyway). Complex situations — inherited property, divorce transfers, home offices with depreciation — deserve a real return, not a widget. If your numbers are large or your facts are messy, talk to a tax professional before you list.