Understanding how much you can afford for a mortgage is a crucial first step in the home-buying process. This Mortgage Affordability Calculator helps you estimate the maximum loan amount you might qualify for, based on your income, debts, and estimated mortgage expenses. Remember, this is an estimate, and your actual loan approval will depend on a lender's detailed assessment of your financial situation, including your credit score, debt-to-income ratio, down payment, and current market conditions.
How it Works:
Lenders typically use a few key metrics to determine mortgage affordability:
Front-End Ratio (or Housing Ratio): This measures the percentage of your gross monthly income that would go towards housing expenses (principal, interest, property taxes, homeowners insurance, and HOA fees). Lenders often prefer this to be no more than 28% of your gross monthly income.
Back-End Ratio (or Debt-to-Income Ratio – DTI): This measures the percentage of your gross monthly income that would go towards all your monthly debt obligations, including your potential mortgage payment, car loans, student loans, and credit card payments. Lenders often prefer this to be no more than 36% of your gross monthly income, though this can vary.
This calculator considers both these ratios to give you a more comprehensive estimate. By inputting your financial details, you can get a clearer picture of your borrowing power and start your home search with more confidence.
Mortgage Affordability Calculator
function calculateMortgageAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var currentMonthlyDebt = parseFloat(document.getElementById("currentMonthlyDebt").value);
var estimatedAnnualPropertyTax = parseFloat(document.getElementById("estimatedAnnualPropertyTax").value);
var estimatedAnnualHomeownersInsurance = parseFloat(document.getElementById("estimatedAnnualHomeownersInsurance").value);
var estimatedAnnualHOA = parseFloat(document.getElementById("estimatedAnnualHOA").value) || 0; // Default to 0 if not provided
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseInt(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("mortgageResult");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(grossMonthlyIncome) || grossMonthlyIncome <= 0 ||
isNaN(currentMonthlyDebt) || currentMonthlyDebt < 0 ||
isNaN(estimatedAnnualPropertyTax) || estimatedAnnualPropertyTax < 0 ||
isNaN(estimatedAnnualHomeownersInsurance) || estimatedAnnualHomeownersInsurance < 0 ||
isNaN(interestRate) || interestRate <= 0 ||
isNaN(loanTerm) || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var monthlyPropertyTax = estimatedAnnualPropertyTax / 12;
var monthlyHomeownersInsurance = estimatedAnnualHomeownersInsurance / 12;
var monthlyHOA = estimatedAnnualHOA / 12;
// Maximum PITI (Principal, Interest, Taxes, Insurance, HOA) based on 28% front-end ratio
var maxMonthlyHousingPayment = grossMonthlyIncome * 0.28;
// Maximum total monthly debt based on 36% back-end ratio
var maxTotalMonthlyDebt = grossMonthlyIncome * 0.36;
// Maximum allowable P&I payment from back-end ratio
var maxMonthlyDebtExcludingHousing = maxTotalMonthlyDebt – currentMonthlyDebt;
var maxMonthlyPI = Math.min(maxMonthlyHousingPayment, maxMonthlyDebtExcludingHousing) – monthlyPropertyTax – monthlyHomeownersInsurance – monthlyHOA;
if (maxMonthlyPI <= 0) {
resultDiv.innerHTML = "Based on your income and debt, you may not qualify for a mortgage with current expenses. Consider increasing income, reducing debt, or finding lower housing costs.";
return;
}
// Calculate maximum loan amount
var monthlyInterestRate = (interestRate / 100) / 12;
var numberOfMonths = loanTerm * 12;
var maxLoanAmount = 0;
// Handle case where monthlyInterestRate is 0 to avoid division by zero
if (monthlyInterestRate === 0) {
maxLoanAmount = maxMonthlyPI * numberOfMonths;
} else {
maxLoanAmount = maxMonthlyPI * (Math.pow(1 + monthlyInterestRate, numberOfMonths) – 1) / monthlyInterestRate / Math.pow(1 + monthlyInterestRate, numberOfMonths);
}
// Display results
var formattedMaxLoanAmount = maxLoanAmount.toFixed(2);
var formattedMaxMonthlyPI = maxMonthlyPI.toFixed(2);
var formattedMaxMonthlyHousingPayment = maxMonthlyHousingPayment.toFixed(2);
var formattedMaxTotalMonthlyDebt = maxTotalMonthlyDebt.toFixed(2);
resultDiv.innerHTML = `
Estimated Affordability:
Estimated Maximum Loan Amount: $${formattedMaxLoanAmount}
This is an estimate based on your inputs and common lending ratios (28% front-end, 36% back-end).
Estimated Maximum Principal & Interest Payment: $${formattedMaxMonthlyPI}
Estimated Maximum Total Monthly Housing Payment (PITI + HOA): $${formattedMaxMonthlyHousingPayment}
Estimated Maximum Total Monthly Debt (including potential mortgage): $${formattedMaxTotalMonthlyDebt}
Disclaimer: This calculator provides an estimation only. Consult with a mortgage lender for a pre-approval and accurate figures.
`;
}