function calculateDTI() {
// Get Input Values
var income = document.getElementById('dti_gross_income').value;
var housing = document.getElementById('dti_housing').value;
var car = document.getElementById('dti_car').value;
var student = document.getElementById('dti_student').value;
var cards = document.getElementById('dti_credit_cards').value;
var other = document.getElementById('dti_other').value;
// Parse Float and handle empty strings
var valIncome = parseFloat(income);
var valHousing = housing === "" ? 0 : parseFloat(housing);
var valCar = car === "" ? 0 : parseFloat(car);
var valStudent = student === "" ? 0 : parseFloat(student);
var valCards = cards === "" ? 0 : parseFloat(cards);
var valOther = other === "" ? 0 : parseFloat(other);
// Validation
if (isNaN(valIncome) || valIncome <= 0) {
alert("Please enter a valid Gross Monthly Income greater than zero.");
return;
}
// Calculations
var totalMonthlyDebt = valHousing + valCar + valStudent + valCards + valOther;
var frontEndRatio = (valHousing / valIncome) * 100;
var backEndRatio = (totalMonthlyDebt / valIncome) * 100;
// Formatting Results
document.getElementById('display_total_debt').innerText = "$" + totalMonthlyDebt.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('display_frontend').innerText = frontEndRatio.toFixed(2) + "%";
document.getElementById('display_backend').innerText = backEndRatio.toFixed(2) + "%";
// Determine Status
var statusContainer = document.getElementById('status_message_container');
var message = "";
var badgeClass = "";
var badgeText = "";
if (backEndRatio <= 36) {
badgeClass = "status-good";
badgeText = "Excellent";
message = "Your DTI is in the ideal range for most lenders.";
} else if (backEndRatio <= 43) {
badgeClass = "status-warning";
badgeText = "Manageable";
message = "You may qualify for loans, but terms might be stricter.";
} else {
badgeClass = "status-danger";
badgeText = "High Risk";
message = "Lenders may consider this ratio too high for new credit.";
}
statusContainer.innerHTML = '' + badgeText + '' + message + ";
// Show Result
document.getElementById('result-container').style.display = "block";
}
Understanding Your Debt-to-Income (DTI) Ratio
Your Debt-to-Income (DTI) ratio is one of the most critical metrics lenders use to assess your financial health. Unlike your credit score, which measures your credit history, your DTI measures your capacity to repay new debt by comparing your monthly debt payments to your gross monthly income.
Why is DTI Important?
When you apply for a mortgage, auto loan, or personal loan, lenders want assurance that you aren't overextended. A lower DTI ratio suggests that you have sufficient income to handle your debts comfortably, making you a more attractive borrower. Conversely, a high DTI indicates potential financial stress, which may lead to loan denial or higher interest rates.
Front-End vs. Back-End Ratio
There are two types of DTI ratios that lenders analyze:
Front-End Ratio: This strictly looks at your housing costs (mortgage principal, interest, taxes, and insurance) divided by your gross income. Most lenders prefer this to be under 28%.
Back-End Ratio: This includes housing costs plus all other recurring monthly debts like credit cards, student loans, and car payments. This is the number calculated by the tool above. Ideally, this should be under 36%.
What is a Good DTI Ratio?
While requirements vary by lender and loan type, the following general guidelines apply:
35% or less: Considered excellent. You likely have money left over for savings and are viewed as a low-risk borrower.
36% to 43%: This is often the maximum range for Qualified Mortgages. You may still get approved, but you might be asked to pay down some debt first.
44% to 49%: Lenders will scrutinize your application closely. You might require a co-signer or show significant cash reserves.
50% or higher: Very few lenders will approve a mortgage with a DTI this high, as it indicates you have very little disposable income.
How to Lower Your DTI
If your calculation shows a high percentage, consider these strategies to improve your standing:
Increase Income: Taking on a side gig, asking for a raise, or including a co-borrower on your application can increase the denominator in the calculation.
Pay Down Debt: Focus on eliminating monthly obligations. Paying off a car loan or a credit card completely removes that monthly payment from the calculation, lowering your ratio significantly more than just paying down a large mortgage balance.
Avoid New Debt: Do not open new credit lines before applying for a major loan, as this will increase your monthly obligations.