Understanding how much you can afford to borrow is a crucial first step in the home-buying process. This mortgage affordability calculator helps you estimate your borrowing power based on your income, debts, and desired loan terms. It takes into account your gross monthly income, existing monthly debt payments, and your desired interest rate and loan term to provide an estimated maximum mortgage amount you might qualify for.
How it works:
The calculator uses a common guideline where lenders often recommend that your total housing costs (including principal, interest, taxes, and insurance – often referred to as PITI) should not exceed 28% of your gross monthly income. Additionally, your total debt payments (including your potential mortgage payment and all other monthly debts like car loans, student loans, and credit card minimums) should not exceed 36% of your gross monthly income. This calculator focuses on the latter, estimating your maximum loan principal based on your income and existing debts.
Important Note: This calculator provides an estimate only. Actual mortgage approval depends on many factors, including your credit score, down payment, lender-specific guidelines, and the current economic climate. It's always best to speak with a mortgage lender for a pre-approval.
Mortgage Affordability Estimate
function calculateAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var monthlyDebtPayments = parseFloat(document.getElementById("monthlyDebtPayments").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(grossMonthlyIncome) || grossMonthlyIncome <= 0) {
resultDiv.innerHTML = "Please enter a valid Gross Monthly Income.";
return;
}
if (isNaN(monthlyDebtPayments) || monthlyDebtPayments < 0) {
resultDiv.innerHTML = "Please enter a valid Total Monthly Debt Payments.";
return;
}
if (isNaN(interestRate) || interestRate 100) {
resultDiv.innerHTML = "Please enter a valid Annual Interest Rate.";
return;
}
if (isNaN(loanTermYears) || loanTermYears <= 0) {
resultDiv.innerHTML = "Please enter a valid Loan Term in Years.";
return;
}
// Common guideline: Total Debt-to-Income (DTI) ratio should not exceed 36%
var maxTotalMonthlyPaymentsAllowed = grossMonthlyIncome * 0.36;
// Calculate the maximum allowable mortgage payment
var maxMortgagePayment = maxTotalMonthlyPaymentsAllowed – monthlyDebtPayments;
if (maxMortgagePayment 0) {
var factor = Math.pow(1 + monthlyInterestRate, numberOfPayments);
maxLoanPrincipal = maxMortgagePayment * (factor – 1) / (monthlyInterestRate * factor);
} else {
// Handle case where interest rate is 0 (though unlikely for mortgages)
maxLoanPrincipal = maxMortgagePayment * numberOfPayments;
}
// Format the result
var formattedMaxLoanPrincipal = maxLoanPrincipal.toLocaleString(undefined, {
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
resultDiv.innerHTML = "Based on your inputs, your estimated maximum affordable mortgage loan principal is: $" + formattedMaxLoanPrincipal + "";
resultDiv.innerHTML += "This estimate assumes your total monthly debt payments (including your estimated mortgage payment) will not exceed 36% of your gross monthly income.";
resultDiv.innerHTML += "Remember, this is an estimate. Your actual borrowing capacity will depend on a lender's full assessment.";
}
.calculator-container {
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
background-color: #f9f9f9;
margin-top: 20px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input[type="number"] {
width: calc(100% – 22px); /* Adjust for padding and border */
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
button {
background-color: #007bff;
color: white;
padding: 10px 15px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 15px;
background-color: #e9ecef;
border: 1px solid #ced4da;
border-radius: 5px;
font-size: 1.1em;
}
#result p {
margin-bottom: 10px;
}