Rent vs. buy calculator
A comparison over a horizon you set, using assumptions you control. There is no right answer here and nothing is being recommended.
Every figure here follows from assumptions you entered, and small changes to them move the answer a great deal. Transaction costs on buying and selling are not included. This comparison is not advice and is not a recommendation to do either thing.