Determining how much house you can afford is a crucial step in the home-buying process.
This calculator helps you estimate your potential mortgage affordability by considering
your income, existing debts, desired down payment, and the terms of the loan.
Lenders typically use a debt-to-income (DTI) ratio to assess your ability to repay
a mortgage. A common guideline is that your total monthly debt payments, including
your potential mortgage principal, interest, taxes, and insurance (PITI), should not
exceed 36% of your gross monthly income. Additionally, your total debt (including
the proposed mortgage) should not exceed 43% of your gross monthly income. This
calculator provides an estimate based on these general principles.
Gross Monthly Income: This is your total income before taxes and
other deductions.
Existing Monthly Debt Payments: Include all recurring monthly payments
for loans, credit cards, and other financial obligations.
Down Payment: The upfront amount you pay towards the home's purchase price.
A larger down payment reduces the loan amount needed.
Annual Interest Rate: The yearly interest rate for the mortgage. This
significantly impacts your monthly payment.
Loan Term (Years): The duration over which you will repay the mortgage.
Longer terms generally result in lower monthly payments but more interest paid over time.
Important Note: This calculator provides an estimate only. Actual
affordability will depend on lender-specific criteria, credit score, property taxes,
homeowners insurance, and other potential fees. It is always recommended to consult
with a mortgage professional for a pre-approval and personalized advice.
function calculateMortgageAffordability() {
var monthlyIncome = parseFloat(document.getElementById("monthlyIncome").value);
var existingDebts = parseFloat(document.getElementById("existingDebts").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(monthlyIncome) || isNaN(existingDebts) || isNaN(downPayment) || isNaN(interestRate) || isNaN(loanTerm)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (monthlyIncome <= 0 || interestRate < 0 || loanTerm <= 0) {
resultDiv.innerHTML = "Income, interest rate, and loan term must be positive values.";
return;
}
// General guideline: Front-end DTI (housing costs) should be around 28-36% of gross monthly income
// Back-end DTI (total debt) should be around 36-43% of gross monthly income
var maxHousingPaymentRatio = 0.36; // Using 36% as a common upper limit for housing
var maxTotalDebtRatio = 0.43; // Using 43% as a common upper limit for total debt
var maxHousingPayment = monthlyIncome * maxHousingPaymentRatio;
var maxTotalDebtPayment = monthlyIncome * maxTotalDebtRatio;
var maxAllowedMortgagePayment = maxTotalDebtPayment – existingDebts;
// Ensure maxAllowedMortgagePayment is not negative
if (maxAllowedMortgagePayment < 0) {
maxAllowedMortgagePayment = 0;
}
// Determine the lower of the two limits for the mortgage payment
var targetMonthlyMortgagePayment = Math.min(maxHousingPayment, maxAllowedMortgagePayment);
// Adjust target monthly mortgage payment if it's less than what existing debts would allow
// This ensures we don't overestimate if existing debts are very high relative to income
if (targetMonthlyMortgagePayment 0) {
// Calculate the maximum mortgage amount the target payment can support
var monthlyInterestRate = (interestRate / 100) / 12;
var numberOfPayments = loanTerm * 12;
if (monthlyInterestRate > 0) {
mortgageAmount = targetMonthlyMortgagePayment * (1 – Math.pow(1 + monthlyInterestRate, -numberOfPayments)) / monthlyInterestRate;
} else {
// Handle zero interest rate scenario
mortgageAmount = targetMonthlyMortgagePayment * numberOfPayments;
}
affordableHomePrice = mortgageAmount + downPayment;
} else {
affordableHomePrice = downPayment; // If no mortgage payment is affordable, the price is just the down payment
}
resultDiv.innerHTML =
"
" +
"
Estimated Mortgage Affordability
" +
"Maximum Affordable Home Price: $" + affordableHomePrice.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "" +
"Estimated Maximum Mortgage Loan Amount: $" + mortgageAmount.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "" +
"Based on a maximum housing payment of $" + maxHousingPayment.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + " and a total debt-to-income ratio of max " + (maxTotalDebtRatio * 100) + "%." +
"