The exemption is not automatic paperwork-free, though. You still report the sale on your tax return and designate the property as your principal residence for the relevant years, and the Canada Revenue Agency can ask for proof that it was actually your home, not a rental or a second property, during that stretch.
Where it gets more complicated is any period the house was not your principal residence, such as a stretch it was rented out or you claimed a home office deduction against it. A lawyer or accountant, often at a fee comparable to the $800 to $1,500 a real estate lawyer charges to close the sale, can confirm whether any partial exemption math applies to your specific timeline.
Online tax calculators cannot see your personal use history, only the sale price, which is exactly the gap that causes people to overestimate what they owe. Get your hand-reviewed valuation from Joel Dyck.