function calculateROI() {
// 1. Get Input Values
var price = parseFloat(document.getElementById('propPrice').value) || 0;
var downPayment = parseFloat(document.getElementById('propDown').value) || 0;
var closingCosts = parseFloat(document.getElementById('propClosing').value) || 0;
var interestRate = parseFloat(document.getElementById('loanRate').value) || 0;
var loanTermYears = parseInt(document.getElementById('loanTerm').value) || 30;
var monthlyRent = parseFloat(document.getElementById('monthlyRent').value) || 0;
var annualTax = parseFloat(document.getElementById('annualTax').value) || 0;
var annualIns = parseFloat(document.getElementById('annualIns').value) || 0;
var annualMaint = parseFloat(document.getElementById('annualMaint').value) || 0;
var vacancyRate = parseFloat(document.getElementById('vacancyRate').value) || 0;
// 2. Perform Calculations
// Income Logic
var grossAnnualIncome = monthlyRent * 12;
var vacancyCost = grossAnnualIncome * (vacancyRate / 100);
var effectiveGrossIncome = grossAnnualIncome – vacancyCost;
// Operating Expenses (Tax, Ins, Maint) – NOTE: Mortgage is NOT an operating expense for NOI
var totalOperatingExpenses = annualTax + annualIns + annualMaint;
// Net Operating Income (NOI)
var noi = effectiveGrossIncome – totalOperatingExpenses;
// Mortgage Calculation
var loanAmount = price – downPayment;
var monthlyMortgage = 0;
if (loanAmount > 0 && interestRate > 0) {
var monthlyRate = (interestRate / 100) / 12;
var numberOfPayments = loanTermYears * 12;
// PMT Formula: P * r * (1+r)^n / ((1+r)^n – 1)
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numberOfPayments)) / (Math.pow(1 + monthlyRate, numberOfPayments) – 1);
} else if (loanAmount > 0 && interestRate === 0) {
monthlyMortgage = loanAmount / (loanTermYears * 12);
}
var annualDebtService = monthlyMortgage * 12;
// Cash Flow
var annualCashFlow = noi – annualDebtService;
var monthlyCashFlow = annualCashFlow / 12;
// Investment Metrics
var totalInitialInvestment = downPayment + closingCosts;
// Cap Rate = (NOI / Purchase Price) * 100
var capRate = (price > 0) ? (noi / price) * 100 : 0;
// Cash on Cash Return = (Annual Cash Flow / Total Cash Invested) * 100
var cashOnCash = (totalInitialInvestment > 0) ? (annualCashFlow / totalInitialInvestment) * 100 : 0;
// 3. Display Results
document.getElementById('reResults').style.display = 'block';
// Format Currency Helper
var fmtMoney = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' });
var fmtPct = new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
// Set Inner HTML
document.getElementById('resCoc').innerHTML = fmtPct.format(cashOnCash) + "%";
document.getElementById('resCap').innerHTML = fmtPct.format(capRate) + "%";
document.getElementById('resCashFlow').innerHTML = fmtMoney.format(monthlyCashFlow);
document.getElementById('resNoi').innerHTML = fmtMoney.format(noi);
document.getElementById('resMortgage').innerHTML = fmtMoney.format(monthlyMortgage);
// Styling classes for positive/negative flow
var cashFlowEl = document.getElementById('resCashFlow');
if (monthlyCashFlow >= 0) {
cashFlowEl.classList.remove('negative');
cashFlowEl.classList.add('positive');
} else {
cashFlowEl.classList.remove('positive');
cashFlowEl.classList.add('negative');
}
}
Understanding Your Rental Property ROI
Investing in real estate is a powerful way to build wealth, but simply buying a property and renting it out doesn't guarantee a profit. To succeed, investors must analyze the numbers objectively. This Rental Property ROI Calculator helps you evaluate two critical metrics: Cap Rate and Cash-on-Cash Return.
What is Net Operating Income (NOI)?
NOI is the foundation of real estate analysis. It represents the profitability of a property before adding in the costs of financing or taxes. The formula used in this calculator is:
NOI = (Gross Rental Income – Vacancy Losses) – Operating Expenses
Operating expenses include property taxes, insurance, maintenance, and management fees, but exclude your mortgage payments. A positive NOI means the property generates enough income to cover its day-to-day operations.
Cap Rate vs. Cash-on-Cash Return
While both metrics measure performance, they serve different purposes:
Cap Rate (Capitalization Rate): This measures the property's natural rate of return assuming you bought it with 100% cash. It is calculated as NOI / Purchase Price. A higher Cap Rate generally indicates a better deal, though it often comes with higher risk (e.g., properties in less desirable neighborhoods often have higher Cap Rates).
Cash-on-Cash Return: This is the most practical metric for investors using leverage (mortgages). It measures the return on the actual cash you put into the deal (Down Payment + Closing Costs). It is calculated as Annual Cash Flow / Total Cash Invested.
How to Interpret Your Results
Positive Cash Flow: If your monthly cash flow is green, your tenant is paying off your mortgage and expenses while putting extra money in your pocket. This is the goal for most "buy and hold" investors.
The 1% Rule: A common rule of thumb is that monthly rent should be at least 1% of the purchase price. For example, a $200,000 home should rent for $2,000/month. While this calculator provides a more detailed analysis, the 1% rule is a good quick filter.
Factors That Affect ROI
Don't forget to account for Vacancy Rates and Maintenance. Even if a property is currently occupied, you will eventually have turnover. We recommend setting aside 5-10% of monthly rent for vacancies and another 5-10% for future repairs (like a new roof or HVAC system) to ensure your cash flow calculation remains realistic over the long term.