Mortgage Affordability Calculator
Understanding how much house you can afford is a crucial first step in the home-buying process. This Mortgage Affordability Calculator helps you estimate your potential borrowing capacity based on your income, debts, and desired down payment. It's important to remember that this is an estimate, and your actual loan approval will depend on a lender's specific criteria, credit score, and other factors.
How Mortgage Affordability is Calculated
Lenders typically use two main ratios to determine how much mortgage you can afford: the Debt-to-Income (DTI) ratio and the front-end ratio (housing expense ratio). While this calculator provides a simplified estimate, it incorporates key factors:
- Annual Gross Income: This is your total income before taxes and other deductions. Lenders want to see if your income can support a mortgage payment.
- Existing Monthly Debt Payments: This includes credit card payments, auto loans, student loans, and any other recurring debts. These are subtracted from your income to see how much is available for housing.
- Down Payment: A larger down payment reduces the loan amount needed, making the mortgage more affordable and potentially securing better loan terms.
- Interest Rate: A higher interest rate means higher monthly payments, thus reducing the amount you can borrow for the same income.
- Loan Term: A longer loan term (e.g., 30 years vs. 15 years) results in lower monthly payments, allowing you to potentially borrow more, although you'll pay more interest over time.
The DTI Ratio: A common guideline is that your total monthly debt payments (including the estimated new mortgage payment) should not exceed 36% to 43% of your gross monthly income. This calculator estimates the maximum affordable mortgage payment and then works backward to estimate the maximum loan amount.
Disclaimer: This calculator is for estimation purposes only. Consult with a mortgage lender for a pre-approval and accurate figures.
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)) {
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, interest rate, and loan term. Debt and down payment can be zero but not negative.";
return;
}
var monthlyIncome = annualIncome / 12;
var maxDtiRatio = 0.43; // A common maximum DTI ratio
var maxHousingPayment = (monthlyIncome * maxDtiRatio) – monthlyDebt;
if (maxHousingPayment 0) {
maxLoanAmount = maxHousingPayment * (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1) / (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments));
} else {
// Handle zero interest rate case (though unlikely for mortgages)
maxLoanAmount = maxHousingPayment * numberOfPayments;
}
var maxHomePrice = maxLoanAmount + downPayment;
resultDiv.innerHTML =
"
Estimated Maximum Home Price You Can Afford: $" + maxHomePrice.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "" +
"
(Based on a maximum 43% DTI ratio, your down payment, and estimated loan terms)" +
"
Estimated Maximum Loan Amount: $" + maxLoanAmount.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "" +
"
Estimated Maximum Affordable Monthly P&I Payment (Principal & Interest): $" + maxHousingPayment.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "";
}
.calculator-container {
font-family: sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.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;
}
.calculator-container button {
grid-column: 1 / -1;
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;
}
.calculator-container button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #fff;
text-align: center;
}
.calculator-result p {
margin-bottom: 10px;
color: #333;
}
.calculator-result span {
color: #28a745;
}
.calculator-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
font-size: 0.95em;
color: #666;
}
.calculator-explanation h3 {
color: #444;
margin-bottom: 10px;
}
.calculator-explanation ul {
margin-left: 20px;
list-style: disc;
}
.calculator-explanation li {
margin-bottom: 8px;
}