Regardless of other factors, it's best to live in the home at a minimum of two years before selling. If one lives in the home as a primary residence for at least two of the five years prior to sale, one can exclude $250,000 ($500,000 for married couples) of the profit from the sale.