Understanding how much you can borrow is a crucial first step in your home-buying journey. Our Mortgage Affordability Calculator helps you estimate the maximum mortgage you might qualify for based on your income, debts, and desired down payment. This tool provides a preliminary estimate and is not a loan guarantee. For precise figures, it's always best to consult with a mortgage lender.
#mortgage-calculator {
font-family: sans-serif;
max-width: 500px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input[type="number"] {
width: calc(100% – 12px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
.result-section {
margin-top: 20px;
padding: 15px;
border: 1px solid #eee;
background-color: #f9f9f9;
border-radius: 4px;
}
.result-section h3 {
margin-top: 0;
color: #333;
}
function calculateMortgageAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebtPayments = parseFloat(document.getElementById("monthlyDebtPayments").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTermYears").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = "; // Clear previous results
if (isNaN(annualIncome) || isNaN(monthlyDebtPayments) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTermYears)) {
resultDiv.innerHTML = 'Please enter valid numbers for all fields.';
return;
}
if (annualIncome <= 0 || monthlyDebtPayments < 0 || downPayment < 0 || interestRate <= 0 || loanTermYears <= 0) {
resultDiv.innerHTML = 'Please enter positive values for income, down payment, interest rate, and loan term. Monthly debt payments cannot be negative.';
return;
}
// General rule of thumb for affordability: Debt-to-Income Ratio (DTI)
// Lenders often look at two DTI ratios:
// 1. Front-end ratio (housing expenses only) – typically no more than 28% of gross monthly income.
// 2. Back-end ratio (all debt, including housing) – typically no more than 36% of gross monthly income.
var grossMonthlyIncome = annualIncome / 12;
// Estimate maximum allowable monthly housing payment (Principal, Interest, Taxes, Insurance – PITI)
// Using the 36% back-end DTI rule as a conservative estimate for maximum total debt.
var maxTotalMonthlyDebtAllowed = grossMonthlyIncome * 0.36;
// Estimate maximum allowable mortgage payment (P&I only) by subtracting existing debts
var maxMonthlyMortgagePayment = maxTotalMonthlyDebtAllowed – monthlyDebtPayments;
if (maxMonthlyMortgagePayment 0) {
var numerator = Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1;
var denominator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments);
maxLoanAmount = maxMonthlyMortgagePayment * (numerator / denominator);
} else {
// Handle zero interest rate case (though rare for mortgages)
maxLoanAmount = maxMonthlyMortgagePayment * numberOfPayments;
}
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
resultDiv.innerHTML = '
Estimated Mortgage Affordability
' +
'Gross Monthly Income: $' + grossMonthlyIncome.toFixed(2) + " +
'Maximum Total Monthly Debt Allowed (36% DTI): $' + maxTotalMonthlyDebtAllowed.toFixed(2) + " +
'Estimated Maximum Monthly Mortgage Payment (P&I): $' + maxMonthlyMortgagePayment.toFixed(2) + " +
'Estimated Maximum Mortgage Loan Amount: $' + maxLoanAmount.toFixed(2) + " +
'Estimated Maximum Home Price (Loan + Down Payment): $' + estimatedMaxHomePrice.toFixed(2) + " +
'Note: This is an estimation. Actual loan amounts depend on lender policies, credit score, property taxes, homeowners insurance, and other factors.';
}