Use this calculator to estimate how much house you can afford based on your income, debts, and down payment. This tool provides an estimate and is not a guarantee of loan approval. Lenders consider many factors beyond these inputs.
function calculateAffordability() {
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) ||
annualIncome < 0 || monthlyDebt < 0 || downPayment < 0 || interestRate < 0 || loanTerm <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
// Lender typically uses Debt-to-Income (DTI) ratio.
// Common front-end DTI (housing expenses) limit is 28% of gross monthly income.
// Common back-end DTI (all debts) limit is 36% of gross monthly income.
// We'll use a conservative approach, considering both.
var grossMonthlyIncome = annualIncome / 12;
var maxHousingPayment = grossMonthlyIncome * 0.28;
var maxTotalDebtPayment = grossMonthlyIncome * 0.36;
var maxMortgagePayment = maxTotalDebtPayment – monthlyDebt;
if (maxMortgagePayment 0 && numberOfPayments > 0) {
principalLoanAmount = affordableMaxMonthlyPayment * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else if (numberOfPayments > 0) { // Handle 0% interest
principalLoanAmount = affordableMaxMonthlyPayment * numberOfPayments;
}
var estimatedMaxHomePrice = principalLoanAmount + downPayment;
resultDiv.innerHTML =
"Estimated Maximum Home Price: $" + estimatedMaxHomePrice.toFixed(2) + "" +
"(This is an estimate and does not include property taxes, homeowner's insurance, or HOA fees, which will increase your actual monthly housing cost.)" +
"Estimated Maximum Loan Amount: $" + principalLoanAmount.toFixed(2) + "" +
"Maximum Affordable Monthly Mortgage Payment (Principal & Interest): $" + affordableMaxMonthlyPayment.toFixed(2) + "";
}
.calculator-container {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 600px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.calculator-inputs {
display: grid;
grid-template-columns: 1fr 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[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.calculator-container button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
border: 1px solid #d4edda;
background-color: #d4edda;
color: #155724;
border-radius: 4px;
text-align: center;
}
.calculator-result p {
margin-bottom: 10px;
font-size: 1.1rem;
}
.calculator-result p:last-child {
margin-bottom: 0;
}
.calculator-result strong {
color: #0c5460;
}