function calculateROI() {
// 1. Get Inputs and parse
var price = parseFloat(document.getElementById('purchasePrice').value);
var closing = parseFloat(document.getElementById('closingCosts').value);
var repairs = parseFloat(document.getElementById('repairCosts').value);
var downPercent = parseFloat(document.getElementById('downPaymentPercent').value);
var interestRate = parseFloat(document.getElementById('interestRate').value);
var loanYears = parseFloat(document.getElementById('loanTerm').value);
var rent = parseFloat(document.getElementById('monthlyRent').value);
var otherInc = parseFloat(document.getElementById('otherIncome').value);
var tax = parseFloat(document.getElementById('propertyTax').value);
var insurance = parseFloat(document.getElementById('insurance').value);
var hoa = parseFloat(document.getElementById('hoaFees').value);
var vacancyPct = parseFloat(document.getElementById('vacancyRate').value);
var maintPct = parseFloat(document.getElementById('maintenanceRate').value);
var mgmtPct = parseFloat(document.getElementById('managementFee').value);
// Error handling
var errorDiv = document.getElementById('errorDisplay');
if (isNaN(price) || isNaN(rent) || isNaN(downPercent) || isNaN(interestRate) || isNaN(loanYears)) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = "Please enter valid numbers for all required fields (Price, Rent, Down Payment, Loan Info).";
document.getElementById('resultsArea').style.display = 'none';
return;
}
errorDiv.style.display = 'none';
// Default values for optionals if NaN
if (isNaN(closing)) closing = 0;
if (isNaN(repairs)) repairs = 0;
if (isNaN(otherInc)) otherInc = 0;
if (isNaN(tax)) tax = 0;
if (isNaN(insurance)) insurance = 0;
if (isNaN(hoa)) hoa = 0;
if (isNaN(vacancyPct)) vacancyPct = 0;
if (isNaN(maintPct)) maintPct = 0;
if (isNaN(mgmtPct)) mgmtPct = 0;
// 2. Calculations
// Cash Invested
var downPaymentAmount = price * (downPercent / 100);
var loanAmount = price – downPaymentAmount;
var totalCashInvested = downPaymentAmount + closing + repairs;
// Mortgage Payment (P&I)
var monthlyRate = (interestRate / 100) / 12;
var numberOfPayments = loanYears * 12;
var monthlyMortgage = 0;
if (interestRate === 0) {
monthlyMortgage = loanAmount / numberOfPayments;
} else {
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numberOfPayments)) / (Math.pow(1 + monthlyRate, numberOfPayments) – 1);
}
// Income
var grossMonthlyIncome = rent + otherInc;
var grossAnnualIncome = grossMonthlyIncome * 12;
// Operating Expenses
var monthlyVacancy = grossMonthlyIncome * (vacancyPct / 100);
var monthlyMaintenance = grossMonthlyIncome * (maintPct / 100);
var monthlyMgmt = grossMonthlyIncome * (mgmtPct / 100);
var monthlyTax = tax / 12;
var monthlyInsurance = insurance / 12;
var totalOperatingExpensesMonthly = monthlyTax + monthlyInsurance + hoa + monthlyVacancy + monthlyMaintenance + monthlyMgmt;
var totalExpensesMonthly = totalOperatingExpensesMonthly + monthlyMortgage;
// Net Operating Income (NOI)
var monthlyNOI = grossMonthlyIncome – totalOperatingExpensesMonthly;
var annualNOI = monthlyNOI * 12;
// Cash Flow
var monthlyCashFlow = grossMonthlyIncome – totalExpensesMonthly;
var annualCashFlow = monthlyCashFlow * 12;
// Returns
var cashOnCash = 0;
if (totalCashInvested > 0) {
cashOnCash = (annualCashFlow / totalCashInvested) * 100;
}
var capRate = (annualNOI / price) * 100;
// 3. Display Results
document.getElementById('resultsArea').style.display = 'block';
document.getElementById('resultCoC').innerHTML = cashOnCash.toFixed(2) + "%";
document.getElementById('resultCoC').style.color = cashOnCash >= 0 ? "#27ae60" : "#c0392b";
document.getElementById('resultMonthlyCashflow').innerHTML = "$" + monthlyCashFlow.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
document.getElementById('resultMonthlyCashflow').style.color = monthlyCashFlow >= 0 ? "#2c3e50" : "#c0392b";
document.getElementById('resultTotalCash').innerHTML = "$" + totalCashInvested.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
document.getElementById('resultCapRate').innerHTML = capRate.toFixed(2) + "%";
document.getElementById('resultExpenses').innerHTML = "$" + totalExpensesMonthly.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
document.getElementById('resultNOI').innerHTML = "$" + annualNOI.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
Understanding Cash on Cash Return in Real Estate
For real estate investors, the Cash on Cash (CoC) Return is arguably the most critical metric for evaluating the performance of a rental property. Unlike a standard Return on Investment (ROI) calculation which might look at the total value of the asset, CoC Return focuses strictly on the cash flow relative to the actual cash you put into the deal.
Why use this calculator?
This Rental Property Cash on Cash Return Calculator helps you determine if a property will generate positive cash flow after all expenses, including your mortgage, taxes, and hidden costs like vacancy and maintenance.
Key Input Definitions
Closing Costs: Fees paid at the closing of a real estate transaction. This point generally includes loan origination fees, appraisal fees, title searches, title insurance, surveys, taxes, deed-recording fees, and credit report charges.
Vacancy Rate: A percentage of time you expect the property to sit empty. A safe conservative estimate is often 5-8% (about 2-4 weeks a year).
CapEx / Maintenance: Money set aside for repairs (leaky faucets) and capital expenditures (new roof, HVAC). Setting aside 5-10% of gross rent is standard practice.
Management Fee: If you hire a property manager, they typically charge 8-10% of the collected rent. If you self-manage, this is 0%, but you are trading your time for equity.
Interpreting Your Results
Cash on Cash Return (%): This percentage tells you how hard your money is working. If you invest $50,000 cash and get $5,000 in positive cash flow per year, your CoC return is 10%.
Cap Rate (Capitalization Rate): This measures the property's natural rate of return without factoring in the mortgage. It is useful for comparing the quality of the asset itself against other properties, regardless of financing.
Note: A "good" Cash on Cash return is subjective, but many investors target 8-12% or higher. In high-appreciation markets, investors might accept lower cash flow returns in exchange for equity growth.