Questions about this
Which improvements count towards the basis?
Work that adds value or extends the life of the home: a new roof, an addition, a finished basement, a replaced HVAC system, new windows. Repairs and maintenance do not, so repainting and fixing a leak are out. Keep the invoices. Twenty years of improvements can move the taxable figure a long way and nobody reconstructs them well from memory.
What if the house was a rental for part of the time?
Then this calculator understates what you owe. Depreciation you claimed while it was a rental is recaptured and taxed separately, and periods of non-qualified use reduce the exclusion proportionally. That combination gets complicated quickly, and it is the single most common reason a seller is surprised by a tax bill. Take it to a CPA before you list.