How to avoid capital gains tax on a home saleLive in the house for at least two years. The two years don’t need to be consecutive, but house-flippers should beware. … See whether you qualify for an exception. … Keep the receipts for your home improvements.