curatedapi

Rent or buy calculator

The net cost of renting against buying a home over a number of years, from assumptions you set, with the first year in which buying comes out ahead.

The price of the home.
Cash paid towards the price.
The mortgage's annual rate.
The mortgage term in years.
How many years to compare.
Rent per month in the first year.
How much the rent rises each year.
How much the home's value changes each year; negative for a fall.
Property tax, insurance and upkeep per year, as a percentage of the home's value.
Costs of buying, as a percentage of the price.
Costs of selling, as a percentage of the sale price.
The yearly return the down payment and buying costs would earn if invested instead.
More options: rounding and decimals
Precision and rounding
Rounding mode applied once to each result. Default half_even.
Round results to this many digits after the decimal point.

Examples

Result: A 400,000 home with 20% down against renting at 2,000 a month, over 10 years

Cost of renting
Net cost of renting over the years.
217,274.80 rounded
Cost of buying
Net cost of buying over the years.
192,396.12 rounded
Difference
cost_of_renting − cost_of_buying: positive when buying is cheaper.
24,878.68 rounded
Cheaper
buy or rent.
buy
Break even year
The first year in which buying costs no more than renting. Absent when that does not happen within the years compared.
8
Home value at end
The home's value after the years.
537,566.55 rounded
Loan balance at end
What is still owed then.
271,283.24 exact

Years table

YearCost of rentingCost of buyingHome valueLoan balance
119,400.0053,414.68412,000.00316,423.24
239,290.0070,491.44424,360.00312,606.96
359,680.1087,211.25437,090.80308,535.08
480,580.47103,553.97450,203.52304,190.51
5102,001.36119,498.20463,709.63299,554.97
6123,953.04135,021.23477,620.92294,608.97
7146,445.85150,098.95491,949.55289,331.75
8169,490.16164,705.76506,708.03283,701.10
9193,096.35178,814.44521,909.27277,693.35
10217,274.80192,396.12537,566.55271,283.24

Rounding: Half even, 2 decimal places. Calculator finance/rent-vs-buy@1.

How it is calculated

buying = down payment + buying costs + mortgage payments + ownership costs − (home value × (1 − selling costs) − loan balance); renting = rent paid − (down payment + buying costs) × ((1 + return)^years − 1)

Adds up what each choice costs over the years you plan to stay. Buying costs the down payment, the buying costs, the mortgage payments and the yearly costs of owning, less what is left after selling the home and repaying the loan. Renting costs the rent, less what the down payment and buying costs would have earned if invested instead. Every growth rate is an input, because the answer depends on them and nobody knows them in advance; change them to see how sure the result is.

  • This is a simple, open model. It leaves out income tax effects, and it does not invest the monthly difference between rent and ownership costs.
  • Ownership costs each year are a percentage of the home's value at the start of that year; rent rises once a year.
  • It is arithmetic on your assumptions, not advice.
  • Amounts are plain numbers in any single currency; no currency conversion is done.

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Use it from your code

POST /v1/calc/finance/rent-vs-buyVersion 1
curl https://api.curatedapi.com/v1/calc/finance/rent-vs-buy \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "home_price": "400000",
    "down_payment": "80000",
    "annual_rate_percent": "6.5",
    "term_years": 30,
    "years": 10,
    "monthly_rent": "2000",
    "rent_increase_percent": "3",
    "home_appreciation_percent": "3",
    "annual_ownership_cost_percent": "2",
    "buying_costs_percent": "3",
    "selling_costs_percent": "6",
    "investment_return_percent": "5"
  }'
The same call in Python
import os

import requests

payload = {
    "home_price": "400000",
    "down_payment": "80000",
    "annual_rate_percent": "6.5",
    "term_years": 30,
    "years": 10,
    "monthly_rent": "2000",
    "rent_increase_percent": "3",
    "home_appreciation_percent": "3",
    "annual_ownership_cost_percent": "2",
    "buying_costs_percent": "3",
    "selling_costs_percent": "6",
    "investment_return_percent": "5",
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/finance/rent-vs-buy",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "home_price": "400000",
    "down_payment": "80000",
    "annual_rate_percent": "6.5",
    "term_years": 30,
    "years": 10,
    "monthly_rent": "2000",
    "rent_increase_percent": "3",
    "home_appreciation_percent": "3",
    "annual_ownership_cost_percent": "2",
    "buying_costs_percent": "3",
    "selling_costs_percent": "6",
    "investment_return_percent": "5",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/finance/rent-vs-buy", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log((await response.json()).result);

MCP tool calc_finance_rent_vs_buy at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="finance/rent-vs-buy" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>

Use a public key registered for your site. Calculations are billed like API calls. How widgets work.

Related calculators

Add this calculator to your website

Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.

Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.