Compare the true net cost of buying a home against renting over the years you plan to stay, accounting for the down payment, appreciation, rent inflation, and the return on money you would invest instead.
It depends on how long you stay, home appreciation, rent inflation, and what you could earn investing the down payment. This tool finds the break-even year for your assumptions.
The year at which the cumulative net cost of buying drops below renting. Before it, renting is cheaper; after it, buying pulls ahead thanks to equity and appreciation.