function calculateRentalROI() {
// 1. Get Input Values
var price = document.getElementById('rpPrice').value;
var downPct = document.getElementById('rpDownPct').value;
var rate = document.getElementById('rpIntRate').value;
var term = document.getElementById('rpTerm').value;
var closing = document.getElementById('rpClosing').value;
var rent = document.getElementById('rpRent').value;
var expenses = document.getElementById('rpExp').value;
// 2. Validate Inputs
if (price === "" || downPct === "" || rate === "" || term === "" || closing === "" || rent === "" || expenses === "") {
alert("Please fill in all fields to calculate the return.");
return;
}
// 3. Parse Numbers
var P = parseFloat(price);
var dp = parseFloat(downPct);
var r = parseFloat(rate);
var t = parseFloat(term);
var cc = parseFloat(closing);
var monthlyRent = parseFloat(rent);
var monthlyExp = parseFloat(expenses);
// 4. Perform Calculations
// Loan Calculation
var downPaymentAmount = P * (dp / 100);
var loanAmount = P – downPaymentAmount;
var monthlyRate = r / 100 / 12;
var numberOfPayments = t * 12;
var monthlyMortgage = 0;
// Mortgage Formula: M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
if (monthlyRate > 0) {
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numberOfPayments)) / (Math.pow(1 + monthlyRate, numberOfPayments) – 1);
} else {
monthlyMortgage = loanAmount / numberOfPayments;
}
// Cash Flow Calculation
var totalMonthlyCosts = monthlyMortgage + monthlyExp;
var monthlyCashFlow = monthlyRent – totalMonthlyCosts;
var annualCashFlow = monthlyCashFlow * 12;
// Investment Base
var totalCashInvested = downPaymentAmount + cc;
// Cash on Cash Return Formula
var cocReturn = 0;
if (totalCashInvested > 0) {
cocReturn = (annualCashFlow / totalCashInvested) * 100;
}
// 5. Update HTML Results
document.getElementById('resTotalInvested').innerText = "$" + totalCashInvested.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resMortgage').innerText = "$" + monthlyMortgage.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
var cfElement = document.getElementById('resCashFlow');
cfElement.innerText = "$" + monthlyCashFlow.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
// Visual Feedback for Negative Cash Flow
if (monthlyCashFlow < 0) {
cfElement.style.color = "#d32f2f";
} else {
cfElement.style.color = "#222";
}
var cocElement = document.getElementById('resCoC');
cocElement.innerText = cocReturn.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) + "%";
// Visual Feedback for Negative ROI
if (cocReturn < 0) {
cocElement.style.color = "#d32f2f";
} else {
cocElement.style.color = "#2e7d32";
}
// Show Results Div
document.getElementById('rpResult').style.display = 'block';
}
Understanding the Cash on Cash Return Calculator
For real estate investors, the Cash on Cash Return (CoC) is one of the most vital metrics for evaluating the potential profitability of a rental property. Unlike a simple ROI (Return on Investment) which might factor in loan paydown or appreciation, the Cash on Cash return focuses strictly on the actual cash flow generated by the property relative to the actual cash you put into the deal.
How is Cash on Cash Return Calculated?
The formula used in this calculator is relatively straightforward but powerful. It answers the question: "For every dollar I invest, how much cash do I get back in my pocket each year?"
Cash on Cash Return = (Annual Pre-Tax Cash Flow / Total Cash Invested) × 100
Where:
Annual Cash Flow: This is your Gross Monthly Rent minus ALL monthly expenses (Mortgage Principal & Interest, Taxes, Insurance, HOA, Maintenance, Vacancy reserves).
Total Cash Invested: This is the sum of your Down Payment and Closing Costs. It creates the denominator of the equation.
Real-World Example
Let's say you are looking at a single-family home using the following numbers:
Purchase Price: $200,000
Down Payment: 20% ($40,000)
Closing Costs: $5,000
Total Cash Invested: $45,000
If the property rents for $2,000/month, and your total monthly expenses (mortgage + taxes + repairs) are $1,600/month, your monthly cash flow is $400.
While every investor has different goals, a Cash on Cash return of 8% to 12% is generally considered healthy in the residential real estate market. Returns above 15% are excellent but may require finding off-market deals or investing in higher-risk neighborhoods.
Why Use This Calculator?
Investing in real estate carries risk. By inputting your specific loan terms, interest rates, and projected expenses into the calculator above, you can avoid negative cash flow situations. Always estimate your expenses conservatively (higher than expected) and your rent conservatively (lower than expected) to ensure your investment remains safe even in market downturns.