The mortgage affordability calculator helps you estimate how much you might be able to borrow for a mortgage. It takes into account your income, existing debts, down payment, and the terms of the loan you're considering.
Key Factors:
Annual Household Income: This is your total gross income per year from all sources. Lenders use this to assess your ability to repay the loan.
Total Monthly Debt Payments: This includes all your current monthly obligations, such as credit card payments, student loans, car loans, and other personal loans. These are often referred to as "back-end" debt.
Down Payment: The upfront amount you pay towards the home purchase. A larger down payment reduces the loan amount needed and can improve your borrowing power.
Estimated Interest Rate: The annual interest rate you expect to pay on the mortgage. Lower rates mean lower monthly payments and potentially a larger loan amount.
Loan Term: The duration of the mortgage, typically 15 or 30 years. A longer term results in lower monthly payments but more interest paid over time.
How it Works:
This calculator uses a common guideline called the "debt-to-income ratio" (DTI). Lenders often have limits on the maximum DTI they will approve. A typical guideline suggests that your total housing expenses (principal, interest, taxes, insurance, and HOA fees) should not exceed 28% of your gross monthly income (front-end DTI), and your total debt obligations (including housing) should not exceed 36% of your gross monthly income (back-end DTI).
This calculator estimates a maximum loan amount based on these principles. It calculates your maximum allowable monthly housing payment and then works backward to determine the principal amount you could borrow. Please remember that this is an estimate, and your actual borrowing capacity may vary based on the lender's specific criteria, credit score, property taxes, homeowner's insurance, and other factors.
function calculateMortgageAffordability() {
var annualIncome = parseFloat(document.getElementById("annualIncome").value);
var monthlyDebt = parseFloat(document.getElementById("monthlyDebt").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(annualIncome) || isNaN(monthlyDebt) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (annualIncome <= 0 || monthlyDebt < 0 || downPayment < 0 || interestRate <= 0 || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter positive values for income, loan term, and interest rate, and non-negative values for debt and down payment.";
return;
}
var grossMonthlyIncome = annualIncome / 12;
// Using a common guideline: Front-end DTI (Housing) around 28% and Back-end DTI (Total Debt) around 36%
// We'll estimate based on maximum allowable housing payment
var maxHousingPayment = grossMonthlyIncome * 0.36 – monthlyDebt; // Simplified back-end DTI approach for max PITI
if (maxHousingPayment 0) {
maxLoanAmount = maxHousingPayment * (Math.pow(1 + monthlyInterestRate, numberOfMonths) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfMonths));
} else { // Handle case of 0% interest rate (unlikely but for completeness)
maxLoanAmount = maxHousingPayment * numberOfMonths;
}
// The calculated maxLoanAmount is for Principal & Interest (P&I).
// Affordability also depends on property taxes, homeowner's insurance, and potential HOA fees.
// For a simplified estimate, we'll present the P&I affordability.
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
resultDiv.innerHTML =
"Estimated Maximum Loan Amount (P&I): $" + maxLoanAmount.toFixed(2) + "" +
"Estimated Maximum Home Price: $" + estimatedMaxHomePrice.toFixed(2) + "" +
"Note: This is an estimate. Actual loan approval depends on lender policies, credit score, property taxes, insurance, and other factors.";
}
.calculator-wrapper {
font-family: sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-wrapper h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.input-group input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
}
button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1em;
cursor: pointer;
transition: background-color 0.3s ease;
margin-bottom: 20px;
}
button:hover {
background-color: #0056b3;
}
.calculator-result {
background-color: #e9ecef;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
text-align: center;
font-size: 1.1em;
border: 1px solid #ced4da;
}
.calculator-result p {
margin: 5px 0;
}
.calculator-result strong {
color: #007bff;
}
.calculator-explanation {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #eee;
font-size: 0.95em;
line-height: 1.6;
color: #444;
}
.calculator-explanation h3 {
color: #333;
margin-bottom: 10px;
}
.calculator-explanation ul {
margin-left: 20px;
margin-bottom: 10px;
}
.calculator-explanation li {
margin-bottom: 5px;
}
.calculator-explanation strong {
color: #555;
}