Understanding how much mortgage you can afford is a crucial first step in the home-buying process. This calculator helps you estimate your maximum loan amount based on your income, debts, and desired monthly payment. Remember, this is an estimate, and your actual borrowing capacity will depend on the lender's specific criteria and market conditions.
How Mortgage Affordability Works
Lenders typically assess your mortgage affordability using a few key metrics. Two common guidelines are the Debt-to-Income (DTI) ratio and the Front-End Ratio (Housing Ratio). While this calculator focuses on a simplified approach based on your income and existing debts to estimate a maximum loan amount, lenders will consider many more factors.
Debt-to-Income (DTI) Ratio:
This ratio compares your total monthly debt payments to your gross monthly income. Lenders often prefer a DTI below 43%, but this can vary.
Front-End Ratio (Housing Ratio):
This ratio compares your potential total housing payment (principal, interest, taxes, and insurance – PITI) to your gross monthly income. A common guideline is to keep this below 28%.
This calculator provides an estimated maximum loan amount by considering your ability to service debt. It assumes a portion of your income is available for a mortgage payment after covering existing debts. The interest rate and loan term significantly impact how much principal you can borrow for a given monthly payment.
Disclaimer: This calculator is for informational purposes only and should not be considered financial advice. Consult with a mortgage professional for personalized guidance.
function calculateMortgageAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var existingMonthlyDebt = parseFloat(document.getElementById("existingMonthlyDebt").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseInt(document.getElementById("loanTermYears").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(grossMonthlyIncome) || isNaN(existingMonthlyDebt) || isNaN(interestRate) || isNaN(loanTermYears) ||
grossMonthlyIncome <= 0 || existingMonthlyDebt < 0 || interestRate <= 0 || loanTermYears <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Estimate maximum affordable monthly housing payment
// This is a simplification. A common guideline is to allocate ~30-40% of income for total housing costs after debt.
// Let's use a conservative estimate, assuming roughly 30% of income is available for PITI after existing debt.
var maxTotalHousingPayment = (grossMonthlyIncome – existingMonthlyDebt) * 0.40; // Using 40% as a generous estimate for total housing PITI
if (maxTotalHousingPayment <= 0) {
resultDiv.innerHTML = "Based on your income and existing debts, it's unlikely you can afford a mortgage at this time.";
return;
}
// Calculate maximum loan amount using the loan payment formula (M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1])
// We need to solve for P (Principal/Loan Amount)
// P = M [ (1 + i)^n – 1] / i(1 + i)^n
var monthlyInterestRate = (interestRate / 100) / 12;
var numberOfPayments = loanTermYears * 12;
if (monthlyInterestRate === 0) {
resultDiv.innerHTML = "Interest rate cannot be zero for this calculation.";
return;
}
var factor = Math.pow(1 + monthlyInterestRate, numberOfPayments);
var loanAmount = maxTotalHousingPayment * (factor – 1) / (monthlyInterestRate * factor);
// Display results
var formattedLoanAmount = loanAmount.toFixed(2);
var formattedMaxHousingPayment = maxTotalHousingPayment.toFixed(2);
resultDiv.innerHTML = `