function calculateROI() {
// Get inputs
var price = document.getElementById('propPrice').value;
var down = document.getElementById('downPayment').value;
var closing = document.getElementById('closingCosts').value;
var rehab = document.getElementById('rehabCosts').value;
var rate = document.getElementById('intRate').value;
var term = document.getElementById('loanTerm').value;
var rent = document.getElementById('monthlyRent').value;
var expenses = document.getElementById('monthlyExp').value;
// Validate inputs
if (price === "" || down === "" || rate === "" || term === "" || rent === "") {
document.getElementById('error-message').style.display = 'block';
document.getElementById('results-display').style.display = 'none';
return;
}
// Parse values
var pPrice = parseFloat(price);
var pDown = parseFloat(down);
var pClosing = closing ? parseFloat(closing) : 0;
var pRehab = rehab ? parseFloat(rehab) : 0;
var pRate = parseFloat(rate);
var pTerm = parseFloat(term);
var pRent = parseFloat(rent);
var pExp = expenses ? parseFloat(expenses) : 0;
document.getElementById('error-message').style.display = 'none';
// 1. Calculate Mortgage Payment
var loanAmount = pPrice – pDown;
var monthlyRate = pRate / 100 / 12;
var totalPayments = pTerm * 12;
var mortgagePayment = 0;
if (monthlyRate > 0) {
mortgagePayment = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, totalPayments)) / (Math.pow(1 + monthlyRate, totalPayments) – 1);
} else {
mortgagePayment = loanAmount / totalPayments;
}
// 2. Calculate Cash Flow
var totalMonthlyExpenses = mortgagePayment + pExp;
var monthlyCashFlow = pRent – totalMonthlyExpenses;
var annualCashFlow = monthlyCashFlow * 12;
// 3. Calculate Total Invested Cash
var totalInvested = pDown + pClosing + pRehab;
// 4. Calculate Cash on Cash ROI
var roi = 0;
if (totalInvested > 0) {
roi = (annualCashFlow / totalInvested) * 100;
}
// Update DOM
document.getElementById('res-total-invested').innerText = "$" + totalInvested.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('res-mortgage').innerText = "$" + mortgagePayment.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('res-total-expenses').innerText = "$" + totalMonthlyExpenses.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
var mFlowElem = document.getElementById('res-monthly-flow');
mFlowElem.innerText = "$" + monthlyCashFlow.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
mFlowElem.style.color = monthlyCashFlow >= 0 ? "#27ae60" : "#c0392b";
var aFlowElem = document.getElementById('res-annual-flow');
aFlowElem.innerText = "$" + annualCashFlow.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
aFlowElem.style.color = annualCashFlow >= 0 ? "#27ae60" : "#c0392b";
var roiElem = document.getElementById('res-roi');
roiElem.innerText = roi.toFixed(2) + "%";
roiElem.style.color = roi >= 0 ? "#27ae60" : "#c0392b";
document.getElementById('results-display').style.display = 'block';
}
Understanding the Cash on Cash Return Calculator
Real estate investing is about the numbers, and the most critical metric for rental property investors is the Cash on Cash Return (CoC ROI). Unlike standard ROI, which might account for total equity buildup, Cash on Cash Return measures the annual cash income earned on the cash you actually invested.
This calculator helps you determine if a potential rental property will generate positive cash flow compared to the money you have to put down upfront. It takes into account your mortgage, closing costs, and ongoing expenses to give you a realistic picture of your investment performance.
How to Calculate Cash on Cash Return
The formula used in this calculator is:
Cash on Cash Return = (Annual Pre-Tax Cash Flow / Total Cash Invested) x 100%
Annual Cash Flow: This is your gross annual rent minus all operating expenses (taxes, insurance, HOA, vacancy, repairs) and debt service (mortgage payments).
Total Cash Invested: This is the total liquid cash you used to acquire the property. It includes the down payment, closing costs, and any immediate renovation or rehab costs.
Input Definitions
Rehab/Repair Costs: If you are buying a "fixer-upper," enter the estimated cost of repairs needed before renting it out. This increases your total cash invested.
Other Monthly Expenses: Don't forget to include Property Taxes, Insurance, HOA fees, Property Management fees (usually 8-10% of rent), and a budget for Maintenance/Vacancy (typically 5-10% of rent).
What is a Good Cash on Cash Return?
While "good" is subjective, many real estate investors aim for a Cash on Cash Return of 8% to 12%. This generally outperforms the stock market average while providing the added benefits of real estate ownership, such as tax depreciation and property appreciation.
If your calculation results in a negative percentage, the property costs more to hold than it generates in income. This implies a negative cash flow, meaning you will have to pay out of pocket every month to keep the property.