function calculateRentalROI() {
// 1. Get input values
var price = parseFloat(document.getElementById("purchasePrice").value) || 0;
var downPercent = parseFloat(document.getElementById("downPayment").value) || 0;
var interestRate = parseFloat(document.getElementById("interestRate").value) || 0;
var termYears = parseFloat(document.getElementById("loanTerm").value) || 0;
var rent = parseFloat(document.getElementById("monthlyRent").value) || 0;
var otherInc = parseFloat(document.getElementById("otherIncome").value) || 0;
var annualTax = parseFloat(document.getElementById("annualTax").value) || 0;
var annualIns = parseFloat(document.getElementById("annualInsurance").value) || 0;
var hoa = parseFloat(document.getElementById("monthlyHOA").value) || 0;
var vacancyPercent = parseFloat(document.getElementById("vacancyRate").value) || 0;
var repairPercent = parseFloat(document.getElementById("repairRate").value) || 0;
var closingCosts = parseFloat(document.getElementById("closingCosts").value) || 0;
// 2. Perform Calculations
var downPaymentAmount = price * (downPercent / 100);
var loanAmount = price – downPaymentAmount;
// Mortgage Payment (P&I) Formula
var monthlyRate = (interestRate / 100) / 12;
var totalPayments = termYears * 12;
var mortgagePayment = 0;
if (interestRate > 0) {
mortgagePayment = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, totalPayments)) / (Math.pow(1 + monthlyRate, totalPayments) – 1);
} else {
mortgagePayment = loanAmount / totalPayments;
}
// Monthly Expenses
var monthlyTax = annualTax / 12;
var monthlyIns = annualIns / 12;
var vacancyCost = rent * (vacancyPercent / 100);
var repairCost = rent * (repairPercent / 100);
var totalMonthlyExpenses = mortgagePayment + monthlyTax + monthlyIns + hoa + vacancyCost + repairCost;
var totalOperatingExpenses = monthlyTax + monthlyIns + hoa + vacancyCost + repairCost; // Excludes mortgage for NOI
// Income
var totalMonthlyIncome = rent + otherInc;
// Key Metrics
var monthlyCashFlow = totalMonthlyIncome – totalMonthlyExpenses;
var monthlyNOI = totalMonthlyIncome – totalOperatingExpenses;
var annualNOI = monthlyNOI * 12;
var annualCashFlow = monthlyCashFlow * 12;
var totalInitialInvestment = downPaymentAmount + closingCosts;
var capRate = 0;
if (price > 0) {
capRate = (annualNOI / price) * 100;
}
var cashOnCash = 0;
if (totalInitialInvestment > 0) {
cashOnCash = (annualCashFlow / totalInitialInvestment) * 100;
}
// 3. Display Results
document.getElementById("rpResult").style.display = "block";
// Helper to format currency
var fmt = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' });
document.getElementById("resCashFlow").innerText = fmt.format(monthlyCashFlow);
document.getElementById("resCashFlow").style.color = monthlyCashFlow >= 0 ? "#0073aa" : "#d63638";
document.getElementById("resCOC").innerText = cashOnCash.toFixed(2) + "%";
document.getElementById("resCOC").style.color = cashOnCash >= 0 ? "#0073aa" : "#d63638";
document.getElementById("resCapRate").innerText = capRate.toFixed(2) + "%";
document.getElementById("resNOI").innerText = fmt.format(monthlyNOI);
// Breakdown
document.getElementById("bdIncome").innerText = fmt.format(totalMonthlyIncome);
document.getElementById("bdMortgage").innerText = fmt.format(mortgagePayment);
document.getElementById("bdTax").innerText = fmt.format(monthlyTax);
document.getElementById("bdInsurance").innerText = fmt.format(monthlyIns);
document.getElementById("bdHOA").innerText = fmt.format(hoa);
document.getElementById("bdVacancy").innerText = fmt.format(vacancyCost);
document.getElementById("bdRepairs").innerText = fmt.format(repairCost);
document.getElementById("bdExpenses").innerText = fmt.format(totalMonthlyExpenses);
}
Understanding Your Rental Property ROI
Investing in real estate is a powerful way to build wealth, but it requires precise calculations to ensure profitability. This Rental Property ROI Calculator helps investors analyze the financial performance of a potential investment property by breaking down monthly income, expenses, and key return metrics.
Key Metrics Explained
Cash Flow: This is the net amount of money moving in or out of your pocket every month. It is calculated by subtracting total expenses (mortgage, taxes, insurance, etc.) from total income. Positive cash flow is essential for a sustainable long-term investment.
Cash on Cash Return (CoC): This metric measures the annual return on the actual cash you invested (down payment + closing costs). A CoC return of 8-12% is generally considered good in the real estate market.
Cap Rate (Capitalization Rate): Cap rate indicates the rate of return on the property based on the income the property generates, exclusive of debt. It helps compare the profitability of similar properties regardless of how they are financed.
Net Operating Income (NOI): This represents the profitability of the property before mortgage payments. Banks often look at NOI to determine if a property generates enough income to cover the debt.
Why Account for Vacancy and Maintenance?
Novice investors often make the mistake of assuming a property will be occupied 100% of the time and nothing will break. Experienced investors always budget for:
Vacancy Rate: A conservative estimate (typically 5-8%) accounts for periods between tenants where no rent is collected.
Maintenance Reserve: Setting aside 5-10% of monthly rent ensures you have funds available for repairs, from leaky faucets to roof replacements.
Use this calculator to stress-test your deals. Try increasing the vacancy rate or interest rate to see if the property still cash flows positively. A good deal should remain profitable even when things don't go perfectly according to plan.