Carl
Level 15

Investors & landlords

You must have lived in the property as your primary residence for 730 days or more, of the last 1826 days you owned it, counting back from the closing date of the sale.

IRS Publication 523 at https://www.irs.gov/pub/irs-pdf/p523.pdf on page 3, 2nd column under "Eligibility Step 3 - Residence". (Make sure you read all the steps, as if you meet Step 1 for automatic disqualification, you can stop there)