Mortgage Affordability Calculator Formula

Understand the math behind the mortgage affordability calculator. Each variable explained with a worked example.

Formulas Used

Affordable Home Price

affordable_home_price = monthly_rate > 0 ? max_monthly_payment * (pow(1 + monthly_rate, num_payments) - 1) / (monthly_rate * pow(1 + monthly_rate, num_payments)) + down_payment : max_monthly_payment * num_payments + down_payment

Maximum Loan Amount

max_loan_amount = monthly_rate > 0 ? max_monthly_payment * (pow(1 + monthly_rate, num_payments) - 1) / (monthly_rate * pow(1 + monthly_rate, num_payments)) : max_monthly_payment * num_payments

Estimated Monthly Payment

estimated_monthly_payment = max_monthly_payment

Variables

VariableDescriptionDefault
annual_incomeAnnual Gross Income(USD)85000
monthly_debtsMonthly Debt Payments(USD)500
down_paymentDown Payment(USD)50000
annual_rateInterest Rate(%)6.5
loan_term_yearsLoan Term(years)30
monthly_incomeDerived value= annual_income / 12calculated
max_housing_paymentDerived value= monthly_income * 0.28calculated
max_total_paymentDerived value= monthly_income * 0.36 - monthly_debtscalculated
max_monthly_paymentDerived value= min(max_housing_payment, max_total_payment)calculated
monthly_rateDerived value= annual_rate / 12 / 100calculated
num_paymentsDerived value= loan_term_years * 12calculated

How It Works

How Mortgage Affordability Is Calculated

Lenders use the 28/36 rule to determine how much you can afford:

  • 28% Rule: Your monthly housing payment should not exceed 28% of gross monthly income
  • 36% Rule: Your total monthly debts (including housing) should not exceed 36% of gross monthly income
  • The calculator takes the lower of these two limits and works backward to find the maximum loan amount you qualify for.

    Worked Example

    You earn $85,000/year with $500/month in existing debts, $50,000 down payment, at 6.5% for 30 years.

    annual_income = 85000monthly_debts = 500down_payment = 50000annual_rate = 6.5loan_term_years = 30
    1. 01Monthly income: $85,000 / 12 = $7,083.33
    2. 0228% rule max housing payment: $7,083.33 * 0.28 = $1,983.33
    3. 0336% rule max total debts: $7,083.33 * 0.36 - $500 = $2,050.00
    4. 04Use lower value: $1,983.33
    5. 05Max loan amount at 6.5% for 30 years: $313,770
    6. 06Affordable home price: $313,770 + $50,000 = $363,770

    Frequently Asked Questions

    What is the 28/36 rule?

    The 28/36 rule states that you should spend no more than 28% of gross monthly income on housing costs and no more than 36% on total debt (housing plus other debts like car loans and credit cards).

    How much house can I afford on my salary?

    As a quick estimate, you can generally afford a home priced at 3-5 times your annual income, depending on your debts, down payment, and interest rate.

    Does this include property taxes and insurance?

    This calculator estimates the maximum based on principal and interest only. Property taxes, insurance, and PMI will reduce the actual amount you can borrow.

    What credit score do I need to buy a house?

    Conventional loans typically require a minimum credit score of 620. FHA loans allow scores as low as 580 with 3.5% down, or 500 with 10% down. The best mortgage rates generally go to borrowers with scores above 740.

    Learn More

    Guide

    How to Calculate Mortgage Payments

    Learn how to calculate mortgage payments step by step. Understand the mortgage payment formula, principal vs. interest breakdown, escrow, PMI, and how to use amortization schedules.