Let's say you rented out the house for 8 years, and lived as primary resident for 2 years before sale. and You made 500K capital gain.
8/10 of the gain is taxable (400K taxable gain). only 2/10 of the gain qualifies for primary residency exclusion. (100K exclusion)