Understanding how much you can afford for a mortgage is a crucial first step in the home-buying process. This calculator helps you estimate your maximum mortgage loan amount based on your income, debts, and desired monthly payment.
How Mortgage Affordability Works
Lenders typically use a debt-to-income ratio (DTI) to determine how much mortgage you can handle. There are two common DTI ratios:
Front-end ratio (or housing ratio): This ratio compares your potential monthly housing expenses (principal, interest, taxes, and insurance – PITI) to your gross monthly income. Lenders often prefer this to be no more than 28%.
Back-end ratio (or total debt ratio): This ratio compares your total monthly debt obligations (including PITI and all other debts like car loans, student loans, and credit card minimum payments) to your gross monthly income. Lenders often prefer this to be no more than 36%, though some may go as high as 43% or more depending on your credit score and other factors.
This calculator focuses on helping you determine a maximum loan amount based on your income, existing debts, and a target monthly payment that aligns with these DTI guidelines.
Mortgage Affordability Calculator
%
(e.g., 0.28 for 28%)
(e.g., 0.36 for 36%)
function calculateMortgageAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var totalMonthlyDebt = parseFloat(document.getElementById("totalMonthlyDebt").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var maxHousingRatio = parseFloat(document.getElementById("maxHousingRatio").value);
var maxTotalRatio = parseFloat(document.getElementById("maxTotalRatio").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(grossMonthlyIncome) || grossMonthlyIncome <= 0 ||
isNaN(totalMonthlyDebt) || totalMonthlyDebt < 0 ||
isNaN(interestRate) || interestRate < 0 ||
isNaN(loanTerm) || loanTerm <= 0 ||
isNaN(downPayment) || downPayment < 0 ||
isNaN(maxHousingRatio) || maxHousingRatio <= 0 ||
isNaN(maxTotalRatio) || maxTotalRatio <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Convert annual interest rate to monthly rate
var monthlyInterestRate = (interestRate / 100) / 12;
// Calculate maximum allowed total monthly debt payment (including PITI)
var maxTotalAllowedPayment = grossMonthlyIncome * maxTotalRatio;
// Calculate maximum allowed PITI (Principal, Interest, Taxes, Insurance)
// This is the maximum total payment minus existing debts
var maxAllowedPITI = maxTotalAllowedPayment – totalMonthlyDebt;
// Ensure PITI is not negative
if (maxAllowedPITI < 0) {
resultDiv.innerHTML = "Based on your current debts and income, you may not qualify for additional mortgage payments. Review your debts and income.";
return;
}
// Further limit PITI by the housing ratio if it's more restrictive
var maxAllowedPITIByHousing = grossMonthlyIncome * maxHousingRatio;
if (maxAllowedPITIByHousing 0) {
var numerator = Math.pow(1 + monthlyInterestRate, numberOfMonths) – 1;
var denominator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfMonths);
if (denominator > 0) {
maxLoanAmount = maxAllowedPITI * (numerator / denominator);
}
} else { // Handle 0% interest rate case
if (numberOfMonths > 0) {
maxLoanAmount = maxAllowedPITI * numberOfMonths;
}
}
// Ensure loan amount is not negative (shouldn't happen with previous checks, but for safety)
maxLoanAmount = Math.max(0, maxLoanAmount);
// The result is the estimated maximum loan amount.
// To find the maximum home price, add the down payment.
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
resultDiv.innerHTML = `
Estimated Maximum Loan Amount: $${maxLoanAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
Estimated Maximum Home Price (incl. down payment): $${estimatedMaxHomePrice.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
Note: This is an estimate. Actual loan approval depends on lender specifics, credit score, property taxes, insurance costs, and other factors.
`;
}