Understanding how much mortgage you can afford is a crucial step in the home-buying process.
This calculator helps you estimate your maximum affordable mortgage loan amount based on your income,
debts, and desired monthly payment. It takes into account key factors that lenders use to determine
your borrowing capacity.
How it Works:
Lenders typically look at your Debt-to-Income (DTI) ratio when assessing your mortgage affordability.
There are two main DTI ratios they consider:
Front-end DTI (Housing Ratio): This ratio compares your potential total monthly housing
payment (principal, interest, taxes, and insurance – PITI) to your gross monthly income. A common
guideline is to keep this below 28%.
Back-end DTI (Total Debt Ratio): This ratio compares your total monthly debt obligations
(including your potential PITI, credit card payments, car loans, student loans, etc.) to your gross
monthly income. A common guideline is to keep this below 36%, though some lenders may allow up to 43% or higher.
This calculator helps you work backward from your desired monthly payment or your maximum acceptable DTI
to estimate the loan amount you might qualify for.
Mortgage Affordability Estimate
function calculateMortgageAffordability() {
var grossMonthlyIncome = parseFloat(document.getElementById("grossMonthlyIncome").value);
var currentMonthlyDebts = parseFloat(document.getElementById("currentMonthlyDebts").value);
var interestRate = parseFloat(document.getElementById("interestRate").value) / 100;
var loanTermYears = parseFloat(document.getElementById("loanTermYears").value);
var estimatedMonthlyTaxesAndInsurance = parseFloat(document.getElementById("estimatedMonthlyTaxesAndInsurance").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(grossMonthlyIncome) || grossMonthlyIncome <= 0 ||
isNaN(currentMonthlyDebts) || currentMonthlyDebts < 0 ||
isNaN(interestRate) || interestRate <= 0 ||
isNaN(loanTermYears) || loanTermYears <= 0 ||
isNaN(estimatedMonthlyTaxesAndInsurance) || estimatedMonthlyTaxesAndInsurance < 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
var loanTermMonths = loanTermYears * 12;
var monthlyInterestRate = interestRate / 12;
// Maximum PITI based on common front-end DTI (28%)
var maxPitiFromFrontEndDTI = grossMonthlyIncome * 0.28;
// Maximum total debt based on common back-end DTI (36%)
var maxTotalDebtFromBackEndDTI = grossMonthlyIncome * 0.36;
// Maximum allowable mortgage payment (PITI) from back-end DTI
var maxPitiFromBackEndDTI = maxTotalDebtFromBackEndDTI – currentMonthlyDebts;
// The most restrictive PITI determines the affordability
var actualMaxPiti = Math.min(maxPitiFromFrontEndDTI, maxPitiFromBackEndDTI);
if (actualMaxPiti 0) {
// Formula for Loan Amount (M): M = P * [1 – (1 + r)^-n] / r
// Where P is the monthly payment for principal and interest
// So, P = affordableMortgagePrincipalPayment
maxMortgageLoanAmount = affordableMortgagePrincipalPayment * (1 – Math.pow(1 + monthlyInterestRate, -loanTermMonths)) / monthlyInterestRate;
} else {
// Handle zero interest rate case (though uncommon for mortgages)
maxMortgageLoanAmount = affordableMortgagePrincipalPayment * loanTermMonths;
}
// Ensure loan amount is not negative
maxMortgageLoanAmount = Math.max(0, maxMortgageLoanAmount);
var formattedMaxLoanAmount = maxMortgageLoanAmount.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedMaxPiti = actualMaxPiti.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedAffordablePrincipalPayment = affordableMortgagePrincipalPayment.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedGrossMonthlyIncome = grossMonthlyIncome.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedCurrentMonthlyDebts = currentMonthlyDebts.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
var formattedEstimatedMonthlyTaxesAndInsurance = estimatedMonthlyTaxesAndInsurance.toLocaleString(undefined, { style: 'currency', currency: 'USD' });
resultDiv.innerHTML =
"
Estimated Affordability:
" +
"Maximum Estimated Monthly Housing Payment (PITI): " + formattedMaxPiti + "" +
"(This is based on a 28% front-end DTI and a 36% back-end DTI, whichever is more restrictive)" +
"Estimated Maximum Principal & Interest Payment: " + formattedAffordablePrincipalPayment + "" +
"Estimated Maximum Mortgage Loan Amount: " + formattedMaxLoanAmount + "" +
"" +
"