Skip to Content
PlaygroundBuy vs Rent Calculator

Buy vs Rent Calculator

Calculator

Core Inputs

Rent Inputs

Buying Inputs

Calculated monthly mortgage repayment: 1,143.21
Starting annual ownership cost: 3,750.00

Renting value after 7 years: 381,614.18
Buying cash after sale in 7 years: 349,940.24
Buying equity after sale in 7 years: 0.00
Buying total after sale in 7 years: 349,940.24

Model Spec

Renting Model

Inputs

  • years shown
  • years to sell house
  • starting cash
  • monthly income
  • monthly expenses
  • monthly rent
  • annual rent increase rate
  • annual investment return rate

Derived Values

months shown = years shown * 12
monthly investment return = monthlyRate(annual investment return rate)
monthly rent increase = monthlyRate(annual rent increase rate)

Initial State

cash starts as starting cash
current monthly rent starts as monthly rent

Record Before Each Month

renting cash series = cash

Monthly Update Order

cash after cashflow = cash + monthly income - monthly expenses - current monthly rent
cash = cash after cashflow * (1 + monthly investment return)
current monthly rent = current monthly rent * (1 + monthly rent increase)

Outputs

ending cash = cash

Buying Model

Inputs

  • years shown
  • starting cash
  • monthly income
  • monthly expenses
  • home price
  • deposit
  • one-time buying cost
  • selling cost rate
  • annual mortgage rate
  • mortgage term in years
  • annual home appreciation rate
  • annual ownership cost rate
  • annual investment return rate

Normalize Inputs

effective home price = max(0, home price)
effective deposit = min(starting cash, max(0, deposit), effective home price)
effective buying cost = max(0, one-time buying cost)
effective selling cost rate = max(0, selling cost rate)
effective annual ownership cost rate = max(0, annual ownership cost rate)

Derived Values

months shown = years shown * 12
initial mortgage = effective home price - effective deposit
monthly investment return = monthlyRate(annual investment return rate)
monthly mortgage rate = monthlyRate(annual mortgage rate)
monthly home appreciation = monthlyRate(annual home appreciation rate)
total mortgage months = floor(mortgage term in years * 12)
sell-after months = floor(years to sell house * 12)
scheduled monthly mortgage payment = mortgagePayment(initial mortgage, monthly mortgage rate, total mortgage months)

Initial State

invested cash starts as starting cash - effective deposit - effective buying cost
mortgage balance starts as initial mortgage
home value starts as effective home price

Record Before Each Month

buying cash series = invested cash
buying house equity series = home value - mortgage balance
buying total series = home value - mortgage balance + invested cash

Monthly Update Order

mortgage interest this month = mortgage balance * monthly mortgage rate
mortgage due this month = mortgage balance + mortgage interest this month
mortgage payment this month = if mortgage balance > 0 then if month < total mortgage months - 1 then scheduled monthly mortgage payment else if month == total mortgage months - 1 then mortgage due this month else 0 else 0

Matches the current final-payment drift correction in simulation.ts.

mortgage balance = if mortgage balance > 0 then mortgage due this month - mortgage payment this month else mortgage balance
ownership cost this month = home value * effective annual ownership cost rate / 100 / 12
invested cash after cashflow = invested cash + monthly income - monthly expenses - mortgage payment this month - ownership cost this month
invested cash = invested cash after cashflow * (1 + monthly investment return)
home value = home value * (1 + monthly home appreciation)
sale proceeds this month = if home value > 0 then if month == sell-after months - 1 then home value * (1 - effective selling cost rate / 100) - mortgage balance else 0 else 0
invested cash = invested cash + sale proceeds this month
mortgage balance = if sale proceeds this month > 0 then 0 else mortgage balance
home value = if sale proceeds this month > 0 then 0 else home value

Outputs

scheduled monthly mortgage payment = scheduled monthly mortgage payment
ending cash = invested cash
ending house equity = home value - mortgage balance
ending net worth = home value - mortgage balance + invested cash