Understanding how much mortgage you can afford is a crucial first step in your home-buying journey. This calculator helps you estimate your maximum affordable loan amount based on your income, debts, and estimated interest rates. It's important to remember that this is an estimate, and your actual loan approval will depend on a lender's specific underwriting criteria.
How Mortgage Affordability Works
Lenders typically use two main ratios to determine how much they're willing to lend you:
Front-End Ratio (Housing Ratio): This ratio compares your potential monthly housing expenses (including principal, interest, property taxes, and homeowner's insurance – often called PITI) to your gross monthly income. A common guideline is that PITI should not exceed 28% of your gross monthly income.
Back-End Ratio (Debt-to-Income Ratio or DTI): This ratio compares all of your monthly debt obligations (including PITI, car loans, student loans, credit card payments, etc.) to your gross monthly income. A common guideline is that your total debt should not exceed 36% of your gross monthly income, though some lenders may allow higher DTIs depending on other factors.
Our calculator simplifies this by allowing you to input your income, existing monthly debts, and an estimated interest rate. It then calculates a potential maximum loan amount that aims to keep your PITI within a reasonable percentage of your income and considers your overall debt burden.
Mortgage Affordability Calculator
function calculateAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var existingMonthlyDebt = parseFloat(document.getElementById("existingMonthlyDebt").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var propertyTaxesAnnual = parseFloat(document.getElementById("propertyTaxesAnnual").value);
var homeownersInsuranceAnnual = parseFloat(document.getElementById("homeownersInsuranceAnnual").value);
var resultDiv = document.getElementById("affordabilityResult");
resultDiv.innerHTML = ""; // Clear previous results
// — Input Validation —
if (isNaN(grossMonthlyIncome) || grossMonthlyIncome <= 0) {
resultDiv.innerHTML = "Please enter a valid Gross Monthly Income.";
return;
}
if (isNaN(existingMonthlyDebt) || existingMonthlyDebt < 0) {
resultDiv.innerHTML = "Please enter a valid Existing Monthly Debt.";
return;
}
if (isNaN(interestRate) || interestRate 20) { // Assuming interest rate is not excessively high
resultDiv.innerHTML = "Please enter a valid Interest Rate (e.g., 3.5 to 7.5).";
return;
}
if (isNaN(loanTerm) || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter a valid Loan Term in years.";
return;
}
if (isNaN(downPayment) || downPayment < 0) {
resultDiv.innerHTML = "Please enter a valid Down Payment amount.";
return;
}
if (isNaN(propertyTaxesAnnual) || propertyTaxesAnnual < 0) {
resultDiv.innerHTML = "Please enter a valid Annual Property Tax amount.";
return;
}
if (isNaN(homeownersInsuranceAnnual) || homeownersInsuranceAnnual < 0) {
resultDiv.innerHTML = "Please enter a valid Annual Homeowner's Insurance amount.";
return;
}
// — Affordability Calculation Logic —
// Common DTI limits used by lenders
var maxDTI_FrontEnd = 0.28; // For PITI
var maxDTI_BackEnd = 0.36; // For total debt obligations
// Calculate maximum total monthly debt payment allowed based on DTI
var maxTotalMonthlyDebtAllowed = grossMonthlyIncome * maxDTI_BackEnd;
// Calculate maximum PITI allowed based on DTI
var maxPITI_allowed = grossMonthlyIncome * maxDTI_FrontEnd;
// Calculate maximum available for PITI after existing debts
var maxPITI_available = maxTotalMonthlyDebtAllowed – existingMonthlyDebt;
// Ensure maxPITI_available is not negative
if (maxPITI_available < 0) {
resultDiv.innerHTML = "Based on your income and existing debts, you may not qualify for an additional mortgage. Your existing debts exceed the maximum allowed by a 36% DTI.";
return;
}
// Use the lower of the two PITI limits
var targetPITI = Math.min(maxPITI_available, maxPITI_allowed);
// Monthly housing expenses (PITI) components
var monthlyPropertyTaxes = propertyTaxesAnnual / 12;
var monthlyHomeownersInsurance = homeownersInsuranceAnnual / 12;
// Calculate the maximum monthly principal and interest (P&I) payment the borrower can afford
var maxMonthlyPI = targetPITI – monthlyPropertyTaxes – monthlyHomeownersInsurance;
// Ensure maxMonthlyPI is not negative
if (maxMonthlyPI <= 0) {
resultDiv.innerHTML = "The estimated property taxes and homeowner's insurance alone exceed the maximum housing payment you can afford based on your income and debt limits. Consider a lower-priced home or a lower interest rate.";
return;
}
// Mortgage P&I formula: M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
// Where:
// M = Monthly Payment (maxMonthlyPI)
// P = Principal Loan Amount (what we need to find)
// i = monthly interest rate (annualRate / 12 / 100)
// n = total number of payments (loanTermInMonths)
var monthlyInterestRate = (interestRate / 100) / 12;
var loanTermInMonths = loanTerm * 12;
var calculatedMaxLoanAmount = 0;
// Check if monthlyInterestRate is very close to zero to avoid division by zero or extremely large numbers
if (Math.abs(monthlyInterestRate) < 1e-9) { // Effectively zero monthly interest rate
calculatedMaxLoanAmount = maxMonthlyPI * loanTermInMonths;
} else {
var numerator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, loanTermInMonths);
var denominator = Math.pow(1 + monthlyInterestRate, loanTermInMonths) – 1;
calculatedMaxLoanAmount = maxMonthlyPI * (denominator / numerator);
}
// The calculated amount is the maximum loan amount *after* the down payment.
// So, the estimated home price is this calculated loan amount + down payment.
var estimatedHomePrice = calculatedMaxLoanAmount + downPayment;
// — Display Results —
var formattedMaxLoanAmount = estimatedHomePrice.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedEstimatedHomePrice = estimatedHomePrice.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxMonthlyPI = maxMonthlyPI.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedTargetPITI = targetPITI.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML = "Based on your inputs:" +
"Estimated Maximum Affordable Home Price: " + formattedEstimatedHomePrice + "" +
"(This includes your estimated down payment of " + downPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' }) + ")" +
"Estimated Maximum Loan Amount: " + calculatedMaxLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' }) + "" +
"Estimated Maximum Monthly P&I Payment: " + formattedMaxMonthlyPI + "" +
"Estimated Maximum Monthly Housing Payment (PITI): " + formattedTargetPITI + "";
}