Mortgage Affordability Calculator
Understanding how much mortgage you can afford is a crucial first step in the home-buying process. This calculator helps you estimate your maximum affordable loan amount based on your income, debts, and desired mortgage terms.
How Mortgage Affordability is Calculated
Lenders typically use a guideline called the "debt-to-income ratio" (DTI) to determine how much they are willing to lend you. There are two main DTI ratios lenders consider:
- Front-end DTI (Housing Ratio): This ratio looks at the percentage of your gross monthly income that would go towards your new mortgage payment (principal, interest, taxes, and insurance – PITI). Lenders often prefer this to be no more than 28%.
- Back-end DTI (Total Debt Ratio): This ratio includes your potential new mortgage payment plus all your other monthly debt obligations. Lenders generally prefer this to be no more than 36% of your gross monthly income, though some may go up to 43% or higher depending on your creditworthiness and other factors.
This calculator uses a simplified approach focusing on the back-end DTI to estimate your maximum affordable mortgage. It considers your income, existing debts, and the potential costs associated with a new mortgage (interest and principal). We've also factored in your down payment, as this reduces the loan amount needed.
Important Considerations:
- This is an estimate. Actual loan approval depends on lender-specific criteria, your credit score, employment history, and the property's appraisal.
- The calculation assumes your estimated monthly income is your gross monthly income (before taxes). If you entered after-tax income, the results will be less accurate.
- Taxes and insurance (PITI) are not explicitly included in this simplified calculation but significantly impact your actual monthly housing costs.
- The interest rate and loan term you select will greatly influence your monthly payment and the total amount you can borrow.
Use this calculator as a starting point to understand your borrowing potential and plan your home-buying budget effectively.
var calculateAffordability = function() {
var monthlyIncome = parseFloat(document.getElementById("monthlyIncome").value);
var existingMonthlyDebt = parseFloat(document.getElementById("existingMonthlyDebt").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var annualInterestRate = parseFloat(document.getElementById("interestRate").value);
var loanTermYears = parseFloat(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Validate inputs
if (isNaN(monthlyIncome) || monthlyIncome <= 0 ||
isNaN(existingMonthlyDebt) || existingMonthlyDebt < 0 ||
isNaN(downPayment) || downPayment < 0 ||
isNaN(annualInterestRate) || annualInterestRate <= 0 ||
isNaN(loanTermYears) || loanTermYears <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Use a common back-end DTI limit (e.g., 36%) for estimation
// Some lenders may go higher, but this is a conservative estimate.
var maxDTI = 0.36;
// Calculate the maximum total monthly debt allowed
var maxTotalMonthlyDebt = monthlyIncome * maxDTI;
// Calculate the maximum monthly mortgage payment allowed
var maxMonthlyMortgagePayment = maxTotalMonthlyDebt – existingMonthlyDebt;
// If existing debt is already too high, no mortgage is affordable
if (maxMonthlyMortgagePayment 0) {
maxLoanAmount = maxMonthlyMortgagePayment * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else { // Handle case for 0% interest rate (though unlikely for mortgages)
maxLoanAmount = maxMonthlyMortgagePayment * numberOfPayments;
}
// Add down payment to get the estimated maximum affordable home price
var estimatedMaxHomePrice = maxLoanAmount + downPayment;
// Format results
var formattedMaxLoanAmount = maxLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedEstimatedMaxHomePrice = estimatedMaxHomePrice.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxMonthlyMortgagePayment = maxMonthlyMortgagePayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML = "
Your Estimated Mortgage Affordability
" +
"Maximum Estimated Monthly Mortgage Payment (Principal & Interest):
" + formattedMaxMonthlyMortgagePayment + "" +
"Estimated Maximum Loan Amount You Can Afford:
" + formattedMaxLoanAmount + "" +
"Estimated Maximum Home Price (including your down payment):
" + formattedEstimatedMaxHomePrice + "" +
"
Note: This is an estimation based on a 36% Debt-to-Income ratio for total monthly debts. It does not include property taxes, homeowner's insurance, or potential Private Mortgage Insurance (PMI).";
};
.calculator-container {
font-family: sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
margin-bottom: 25px;
padding: 15px;
border: 1px solid #eee;
background-color: #fff;
border-radius: 5px;
}
.input-group {
display: flex;
flex-direction: column;
}
.input-group label {
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.input-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1em;
}
.calculator-inputs button {
grid-column: 1 / -1; /* Span across all columns */
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 1.1em;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-inputs button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #d4edda;
background-color: #d4edda;
color: #155724;
border-radius: 5px;
text-align: center;
}
.calculator-result h4 {
margin-top: 0;
color: #155724;
}
.calculator-result p {
margin-bottom: 10px;
font-size: 1.1em;
}
.calculator-result strong {
font-size: 1.2em;
}
.calculator-result small {
display: block;
margin-top: 10px;
font-size: 0.85em;
opacity: 0.8;
}
.calculator-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
color: #333;
line-height: 1.6;
}
.calculator-explanation h3 {
color: #444;
margin-bottom: 15px;
}
.calculator-explanation ul {
margin-left: 20px;
margin-bottom: 15px;
}
.calculator-explanation li {
margin-bottom: 8px;
}
.calculator-explanation strong {
color: #007bff;
}