function calculateDTI() {
// Get inputs using var and safeguard against NaN or empty inputs with OR operators
var grossIncome = parseFloat(document.getElementById('dtiGrossIncome').value) || 0;
var rentMortgage = parseFloat(document.getElementById('dtiRentMortgage').value) || 0;
var carLoans = parseFloat(document.getElementById('dtiCarLoans').value) || 0;
var creditCards = parseFloat(document.getElementById('dtiCreditCards').value) || 0;
var studentLoans = parseFloat(document.getElementById('dtiStudentLoans').value) || 0;
var otherDebts = parseFloat(document.getElementById('dtiOtherDebts').value) || 0;
// Get result elements
var resultDiv = document.getElementById('dti-result');
var percentageSpan = document.getElementById('dti-percentage');
var statusSpan = document.getElementById('dti-status');
var summaryP = document.getElementById('dti-summary');
// Validation: Income must be greater than zero to avoid division by zero
if (grossIncome <= 0) {
alert("Please enter a valid Gross Monthly Income greater than zero.");
resultDiv.style.display = 'none';
return;
}
// Calculate total monthly debt
var totalDebt = rentMortgage + carLoans + creditCards + studentLoans + otherDebts;
// Calculate DTI ratio
var dtiRatio = (totalDebt / grossIncome) * 100;
// Round to two decimal places
dtiRatio = Math.round(dtiRatio * 100) / 100;
// Display result
percentageSpan.innerHTML = dtiRatio.toFixed(2) + "%";
resultDiv.style.display = 'block';
// Determine status and color styling
var statusText = "";
var statusClass = "";
var summaryText = "";
// General lending guidelines benchmarks
if (dtiRatio 36 && dtiRatio <= 43) {
statusText = "Manageable / Caution";
statusClass = "status-warning";
summaryText = "Your debt level is becoming high. You may still qualify for loans, but perhaps at higher interest rates. It's acceptable for a Qualified Mortgage, but lenders may scrutinize closer.";
} else {
statusText = "High Risk";
statusClass = "status-danger";
summaryText = "This ratio is considered high risk by most lenders. You may face difficulty getting approved for new credit or mortgages without reducing debt or increasing income.";
}
// Update status display
statusSpan.innerHTML = statusText;
statusSpan.className = statusClass;
summaryP.innerHTML = summaryText;
}
Understanding Your Debt-to-Income (DTI) Ratio
Your Debt-to-Income (DTI) ratio is a critical financial metric that compares how much you owe each month to how much you earn. It is expressed as a percentage and is one of the primary factors lenders, particularly mortgage lenders, use to assess your ability to manage monthly payments and repay debts.
In short, it tells lenders how much of your monthly pre-tax income is already accounted for by existing debt obligations. A lower ratio suggests that you have a good balance between debt and income, indicating less risk to lenders.
How DTI is Calculated
The formula for DTI is straightforward, as used in the calculator above:
It's important to note what is included in "Gross Monthly Income" and "Monthly Debt Payments".
Gross Monthly Income: This is your total income before taxes and other deductions.
Included Debts: Lenders look at minimum required monthly payments for obligations like rent/mortgage, car loans, student loans, credit card minimums, child support, and alimony.
Excluded Expenses: DTI typically does not include variable monthly expenses like groceries, utilities, gas, or entertainment.
What is a Good DTI Ratio?
While different lenders have different criteria, here are general guidelines used in the financial industry, particularly for mortgage lending:
36% or Less (Healthy): This is considered the ideal range. It shows lenders you have sufficient income to handle your current debts plus potential new ones. The famous "28/36 rule" suggests spending no more than 28% of income on housing and no more than 36% on total debt.
37% to 43% (Manageable): You will likely still qualify for most loans in this range, but lenders might view you as a slightly higher risk. 43% is generally the highest DTI a borrower can have and still get a Qualified Mortgage.
44% or Higher (High Risk): Lenders may hesitate to approve new credit. If approved, you might face higher interest rates or stricter terms. It suggests a significant portion of your income is tied up in debt repayment.
Why Your DTI Matters
Even if you have an excellent credit score and pay bills on time, a high DTI can result in loan denial. It measures your capacity to take on new debt. If your DTI is currently 50%, for example, it means half of every dollar you earn before taxes is already spoken for by creditors, leaving less room for new payments or unexpected expenses.
How to Improve Your DTI
Since the ratio has two components—debt and income—there are two ways to improve it:
Decrease Debt: Focus on paying off debts with high monthly payments first. Note that paying down a credit card balance only helps your DTI if it lowers the minimum monthly payment required on that card. Paying off an installment loan (like a car loan) completely eliminates that monthly payment from the calculation.
Increase Income: Increasing your gross monthly income through a raise, a higher-paying job, or a side hustle will lower your ratio, provided your debts remain the same.