This calculator helps you estimate the maximum mortgage loan you can afford based on your income, debts, and down payment. Understanding your potential borrowing capacity is a crucial first step in the home-buying process.
How Mortgage Affordability is Calculated
Lenders typically use debt-to-income (DTI) ratios to determine how much you can borrow. There are two common DTI ratios:
Front-end DTI (Housing Ratio): This ratio compares your potential PITI (Principal, Interest, Taxes, and Insurance) payment to your gross monthly income. A common guideline is to keep this below 28%.
Back-end DTI (Total Debt Ratio): This ratio compares your PITI plus all other monthly debt obligations (car loans, student loans, credit card minimums) to your gross monthly income. A common guideline is to keep this below 36%, though some lenders may go up to 43% or even higher depending on other factors.
This calculator uses a simplified approach by estimating your maximum affordable monthly payment based on these DTI guidelines, then calculating the maximum loan amount you could support with that payment. It assumes a standard PITI calculation and does not include property taxes and homeowner's insurance in detail, but rather uses them as a factor in the overall DTI guideline.
Important Note: This is an estimate. Actual loan approval depends on lender-specific criteria, credit score, loan type, and market conditions.
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 600px;
margin: 20px auto;
background-color: #f9f9f9;
}
.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: #333;
}
.input-group input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.calculator-container button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1.1rem;
margin-top: 10px;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #45a049;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
font-size: 1.1rem;
text-align: center;
}
.calculator-result p {
margin: 0;
}
.calculator-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.calculator-explanation h3 {
margin-bottom: 10px;
color: #333;
}
.calculator-explanation p, .calculator-explanation ul {
line-height: 1.6;
color: #555;
}
.calculator-explanation ul {
padding-left: 20px;
}
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 loanTerm = parseFloat(document.getElementById("loanTerm").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = "; // Clear previous results
if (isNaN(annualIncome) || isNaN(monthlyDebtPayments) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm)) {
resultDiv.innerHTML = 'Please enter valid numbers for all fields.';
return;
}
if (annualIncome <= 0 || monthlyDebtPayments < 0 || downPayment < 0 || interestRate <= 0 || loanTerm <= 0) {
resultDiv.innerHTML = 'Please enter positive values for income, rate, and term, and non-negative values for debts and down payment.';
return;
}
var monthlyIncome = annualIncome / 12;
// Using common DTI guidelines (e.g., 28% for housing, 36% for total debt)
// We'll calculate based on the more restrictive total debt DTI for a conservative estimate.
var maxTotalDebtPayment = monthlyIncome * 0.36; // Max allowed for PITI + other debts
var maxMonthlyMortgagePayment = maxTotalDebtPayment – monthlyDebtPayments;
// Ensure maxMonthlyMortgagePayment is not negative
if (maxMonthlyMortgagePayment 0 && numberOfPayments > 0) {
var mortgageFactor = Math.pow(1 + monthlyInterestRate, numberOfPayments);
calculatedLoanAmount = maxMonthlyMortgagePayment * (mortgageFactor – 1) / mortgageFactor / monthlyInterestRate;
} else {
// Handle case of 0 interest rate or term (though unlikely for mortgages)
calculatedLoanAmount = maxMonthlyMortgagePayment * numberOfPayments; // Simplified if rate is 0
}
// The calculatedLoanAmount is the maximum loan you can afford, *before* considering the down payment.
// The total home price affordability is loan amount + down payment.
var maxLoanAffordability = calculatedLoanAmount; // This is the maximum loan amount
// Display the results
var formattedMaxLoan = maxLoanAffordability.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedDownPayment = downPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var totalEstimatedAffordability = maxLoanAffordability + downPayment;
var formattedTotalAffordability = totalEstimatedAffordability.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML = 'Estimated Maximum Loan Amount You Can Afford: ' + formattedMaxLoan + " +
'Estimated Total Home Purchase Affordability (Loan + Down Payment): ' + formattedTotalAffordability + ";
}