This is factually incorrect.
After two years, you can sell your home and enjoy a 250k exemption on your capital gains, or 500k if you are married. Meaning if you are single and you bought your house two years ago for 350k, you can sell it now for 600k and pay no taxes. Every dollar you earn after that is taxable, although realtor fees, county/city transfer tax etc all get deducted off the top before you factor in your gain.
In order to qualify for this exemption, it has to have been your primary residence for two of the last 5 years. So you could move out and still get this exemption 3 years later and then do a 1031 exchange with the remaining balance (assuming you 'converted' the property to rental property).
So if you bought your home for 350k, lived there for two years, moved out, rented out the home (for a minimum of 2 years), then sold it within year 5 for 1 million, you would take 250k off the top for your non taxable exemption (500k if married), then could do a 1031 exchange with the remaining 750k and pay no tax whatsoever. You would pay no tax by doing a 1031 if this happens in year 6+, but would be required to buy a property of or exceeding 1 million to pay no tax (you can always buy something for 900k and only pay tax on 100k in this scenario as well). Obviously you could have lived there longer than two years as well, in order to qualify for the capital gains exemption you just have to have lived there for 2 of the last 5 years, and I don't think it has to be consecutively
If any of that is confusing, just forget the 1031 exchange part of the equation and just focus on the first paragraph and a half. If you've lived there two years already, you already qualify for this exemption and it does not increase to 'unlimited non taxable gain' after 5 years