Use this calculator to estimate how much you can afford to borrow for a mortgage. Understanding your potential borrowing power is a crucial first step in the home-buying process. This calculator takes into account your income, debts, and desired down payment to provide an estimated mortgage amount.
How Mortgage Affordability is Calculated
Lenders use several factors to determine how much mortgage you can afford. A common guideline is the Debt-to-Income Ratio (DTI). Generally, lenders prefer your total monthly housing costs (principal, interest, taxes, insurance – PITI) plus your existing monthly debt payments to be no more than 36% to 43% of your gross monthly income. Some lenders may go higher depending on your credit score and overall financial profile.
This calculator uses a simplified approach. It estimates the maximum monthly payment you can afford based on your income and existing debts, and then works backward to determine the maximum loan amount you could take out given a specific interest rate and loan term. The formula for monthly payment (M) is:
M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
Where:
P = Principal loan amount
i = Monthly interest rate (annual rate / 12)
n = Total number of payments (loan term in years * 12)
We rearrange this to solve for P (the loan amount) based on the maximum affordable monthly payment derived from your income and debts.
Important Considerations:
Interest Rates: Higher interest rates mean a smaller loan amount for the same monthly payment.
Loan Term: Longer loan terms can lower your monthly payments but increase the total interest paid over time.
Property Taxes and Homeowner's Insurance: These are mandatory costs included in your monthly mortgage payment (PITI) and significantly impact affordability. This calculator does not explicitly factor these in; you will need to estimate these yourself and ensure your calculated affordability covers them.
Private Mortgage Insurance (PMI): If your down payment is less than 20%, you'll likely need to pay PMI, which adds to your monthly housing cost.
Lender Requirements: This is an estimate. Your actual loan approval will depend on the specific lender's criteria, your credit score, employment history, and other factors.
function calculateMortgageAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var monthlyDebtPayments = parseFloat(document.getElementById("monthlyDebtPayments").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var annualInterestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTermYears").value);
var resultElement = document.getElementById("mortgageAffordabilityResult");
resultElement.innerHTML = "; // Clear previous results
// Input validation
if (isNaN(grossMonthlyIncome) || grossMonthlyIncome <= 0 ||
isNaN(monthlyDebtPayments) || monthlyDebtPayments < 0 ||
isNaN(downPayment) || downPayment < 0 ||
isNaN(annualInterestRate) || annualInterestRate <= 0 ||
isNaN(loanTermYears) || loanTermYears <= 0) {
resultElement.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Assume a maximum DTI for total housing costs + debts (e.g., 36%)
var maxTotalDebtRatio = 0.36; // This is a common guideline, can be adjusted
// Calculate maximum affordable total monthly payment
var maxTotalMonthlyPayment = grossMonthlyIncome * maxTotalDebtRatio;
// Calculate maximum affordable housing payment (PITI)
var maxHousingPayment = maxTotalMonthlyPayment – monthlyDebtPayments;
if (maxHousingPayment <= 0) {
resultElement.innerHTML = "Based on your income and existing debts, your maximum affordable housing payment is too low to qualify for a mortgage. Consider increasing income or reducing debts.";
return;
}
// Convert annual interest rate to monthly interest rate
var monthlyInterestRate = (annualInterestRate / 100) / 12;
// Calculate the total number of payments
var numberOfPayments = loanTermYears * 12;
// Calculate the maximum loan amount (Principal, P) using the mortgage payment formula rearranged
// M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
// P = M * [ (1 + i)^n – 1] / [ i(1 + i)^n ]
var principal;
if (monthlyInterestRate === 0) { // Handle 0% interest rate edge case
principal = maxHousingPayment * numberOfPayments;
} else {
var numerator = Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1;
var denominator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments);
principal = maxHousingPayment * (numerator / denominator);
}
var estimatedMortgageAmount = principal;
var estimatedHomePrice = estimatedMortgageAmount + downPayment;
resultElement.innerHTML =
"