The tool plays out two lives month by month. In one you buy: you pay the down payment and buying costs, then the mortgage, property tax, insurance and maintenance, and at the end you sell the home and pay selling costs. In the other you rent and invest the down payment and buying costs instead.
Each month the cheaper of the two lives puts the difference into investments that earn the return you enter. When owning costs more than renting, the renter invests the gap. When renting costs more, the gap counts in favour of buying at the same return. This keeps the comparison fair.
Net cost of buying is everything you spent on the home minus what you get back when you sell and repay the mortgage. Net cost of renting is the rent and renter’s insurance you paid minus the growth on the money you invested. The break-even year is the first year in which buying has cost less if you sold at the end of it.
The investment return is the opportunity cost of tying money up in a home, and it is the biggest swing in the answer. Raise it and renting looks better; lower it and buying does. The same goes for home price growth. Run a few values for both before you trust the result.
Check it by hand with the default numbers: a 400,000 home with 20% down means borrowing 320,000. At 6.5% over 30 years the payment is about 2,022.62 a month. Add property tax of 1% a year (333.33 a month), insurance of 1,500 a year (125) and maintenance of 1% a year (333.33), and owning costs about 2,814 a month. Renting at 2,500 plus 200 a year of renter's insurance costs about 2,517. Owning is dearer each month, so buying only wins if the equity it builds is worth more than what the down payment and closing costs would have earned elsewhere.