A taxpayer can generally exclude from taxable income up to $250,000 ($500,000 for qualifying joint filers) of gain from the sale of a home owned and used as a principal residence for at least two of the five years before the sale (the ownership and use tests).