Use this calculator to estimate the maximum mortgage you might qualify for based on your income, debts, and desired loan terms. Understanding your potential borrowing power is a crucial first step in the home-buying process.
How Mortgage Affordability Works
Lenders assess your ability to repay a mortgage based on several factors, primarily your income, existing debts, and the proposed loan. Two common metrics they use are the Debt-to-Income (DTI) ratio:
Front-End DTI (Housing Ratio): This measures the percentage of your gross monthly income that would go towards your housing expenses (principal, interest, taxes, and insurance – PITI). Lenders often prefer this to be below 28%.
Back-End DTI (Total Debt Ratio): This measures the percentage of your gross monthly income that would go towards all your monthly debt obligations, including your potential mortgage payment. Lenders typically want this below 36% to 43%, depending on the loan type and your creditworthiness.
This calculator provides an estimated maximum loan amount by considering these DTI limits. It assumes standard ratios for illustrative purposes. Your actual borrowing capacity may vary based on lender policies, credit score, loan program, and other financial factors.
Disclaimer: This calculator is for estimation purposes only and does not constitute financial advice. Consult with a mortgage professional for precise figures and pre-approval.
function calculateMortgageAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebt = parseFloat(document.getElementById("monthlyDebt").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(annualIncome) || isNaN(monthlyDebt) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (annualIncome <= 0 || monthlyDebt < 0 || downPayment < 0 || interestRate <= 0 || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter positive values for income, interest rate, and loan term, and non-negative values for debt and down payment.";
return;
}
var grossMonthlyIncome = annualIncome / 12;
// — Calculation Logic —
// Using common lender guidelines (approximate)
// Max housing payment (PITI) often around 28% of gross monthly income
var maxHousingPayment = grossMonthlyIncome * 0.28;
// Max total debt payment often around 36% of gross monthly income
var maxTotalDebtPayment = grossMonthlyIncome * 0.36;
// Max allowed mortgage payment based on total debt (back-end DTI)
var maxMortgagePaymentFromDebt = maxTotalDebtPayment – monthlyDebt;
if (maxMortgagePaymentFromDebt < 0) {
maxMortgagePaymentFromDebt = 0; // Cannot afford any mortgage if existing debt exceeds limit
}
// The actual maximum mortgage payment is the lower of the two limits
var maxMortgagePayment = Math.min(maxHousingPayment, maxMortgagePaymentFromDebt);
// Now, calculate the maximum loan amount based on the maxMortgagePayment
// We need to account for Principal & Interest (P&I) only, as taxes and insurance (TI) are part of the housing payment limit
// We'll estimate TI as a portion of the loan value, or use a simpler approach by calculating P&I directly from maxMortgagePayment if we assume TI is included.
// For simplicity in this calculator, we'll assume maxMortgagePayment is primarily for P&I and adjust.
// A more precise calculation would separate PITI. Let's assume maxHousingPayment *includes* a rough estimate for taxes and insurance.
// So, the P&I portion of the maxHousingPayment needs to be calculated.
// Let's use a common estimate for PITI as ~20-25% of the total housing payment for property taxes and homeowner's insurance.
// This is a rough estimate.
var estimatedTaxesAndInsurance = maxHousingPayment * 0.20; // Assuming 20% for T&I
var maxPrincipalAndInterest = maxHousingPayment – estimatedTaxesAndInsurance;
if (maxPrincipalAndInterest 0 && numberOfPayments > 0) {
var numerator = Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1;
var denominator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments);
if (denominator > 0) {
maxLoanAmount = actualMaxPrincipalAndInterest * (numerator / denominator);
} else {
// Handle case where interest rate is extremely low or zero, which can cause division by zero
// In such a case, loan amount is simply payment * number of months, assuming 0 interest.
maxLoanAmount = actualMaxPrincipalAndInterest * numberOfPayments;
}
} else if (numberOfPayments > 0) { // Handle 0% interest rate specifically
maxLoanAmount = actualMaxPrincipalAndInterest * numberOfPayments;
}
// The total home affordability is the max loan amount plus the down payment
var totalAffordability = maxLoanAmount + downPayment;
// Format results
var formattedMaxLoanAmount = maxLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedTotalAffordability = totalAffordability.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedGrossMonthlyIncome = grossMonthlyIncome.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxHousingPayment = maxHousingPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxTotalDebtPayment = maxTotalDebtPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML = `