function calculateDTI() {
// Get inputs using var
var incomeInput = document.getElementById('monthlyGrossIncome');
var rentInput = document.getElementById('monthlyRentMortgage');
var carInput = document.getElementById('monthlyCarLoan');
var studentInput = document.getElementById('monthlyStudentLoan');
var cardInput = document.getElementById('monthlyCreditCard');
var otherInput = document.getElementById('monthlyOtherDebt');
// Parse values, defaulting to 0 if empty or invalid
var income = parseFloat(incomeInput.value) || 0;
var rent = parseFloat(rentInput.value) || 0;
var car = parseFloat(carInput.value) || 0;
var student = parseFloat(studentInput.value) || 0;
var card = parseFloat(cardInput.value) || 0;
var other = parseFloat(otherInput.value) || 0;
// Validation
if (income <= 0) {
alert("Please enter a valid Gross Monthly Income greater than zero.");
return;
}
// Calculations
var totalDebt = rent + car + student + card + other;
var dtiRatio = (totalDebt / income) * 100;
// Logic for status classification
var statusText = "";
var statusClass = "";
var adviceText = "";
if (dtiRatio 35 && dtiRatio 43 && dtiRatio <= 50) {
statusText = "High";
statusClass = "status-red";
adviceText = "Your DTI is high. You may face difficulties getting approved for a standard mortgage without reducing debt or increasing income.";
} else {
statusText = "Critical";
statusClass = "status-red";
adviceText = "Your debt load is critical relative to your income. It is highly recommended to focus on debt repayment before applying for new credit.";
}
// Display Results
var resultBox = document.getElementById('dti-result-box');
var percentageDisplay = document.getElementById('dti-percentage');
var statusContainer = document.getElementById('dti-status-container');
var breakdownDisplay = document.getElementById('dti-breakdown');
percentageDisplay.innerHTML = dtiRatio.toFixed(2) + "%";
statusContainer.innerHTML = '' + statusText + '' + adviceText + ";
breakdownDisplay.innerHTML =
'Summary:' +
'Total Monthly Income: $' + income.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) + " +
'Total Monthly Debt: $' + totalDebt.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) + " +
'Remaining Income: $' + (income – totalDebt).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
resultBox.style.display = "block";
}
What is a Debt-to-Income (DTI) Ratio?
Your Debt-to-Income (DTI) ratio is one of the most critical metrics lenders use to assess your creditworthiness. It represents the percentage of your gross monthly income that goes toward paying your monthly debt obligations. Unlike your credit score, which measures your history of paying debts, the DTI measures your capacity to repay new debts.
Why Your DTI Score Matters for Loans
When you apply for a mortgage, personal loan, or auto loan, lenders want to ensure you have enough cash flow to handle the new payment. A lower DTI indicates that you have a good balance between debt and income.
35% or less: Generally viewed as ideal. You likely have money left over for saving and investing.
36% to 43%: This is the standard "manageable" range. 43% is often the highest DTI a borrower can have to get a Qualified Mortgage.
44% or higher: Lenders may view you as a risky borrower. You might only qualify for subprime loans with higher interest rates.
Front-End vs. Back-End DTI
There are technically two types of DTI ratios used in mortgage lending:
Front-End Ratio: This only calculates the percentage of income that goes toward housing costs (rent, mortgage, property taxes, HOA fees). Lenders typically prefer this to be under 28%.
Back-End Ratio: This is the number calculated by the tool above. It includes housing costs plus all other recurring debt (credit cards, student loans, car notes). Lenders usually cap this at 43% for conventional loans.
How to Lower Your DTI Ratio
If your calculation shows a high percentage, you can improve your standing by either increasing your income (side hustles, promotions) or, more commonly, paying down debt. The most effective strategy is to eliminate monthly obligations entirely—such as paying off a car loan or clearing a credit card balance—rather than just paying a little extra on a large mortgage principal.