Please enter valid positive numbers for all fields.
Investment Analysis
Monthly Principal & Interest:$0.00
Total Monthly Expenses:$0.00
Monthly Cash Flow:$0.00
Net Operating Income (Annual):$0.00
Cap Rate:0.00%
Cash on Cash Return:0.00%
function calculateROI() {
// 1. Get Inputs using var as requested
var purchasePrice = parseFloat(document.getElementById("purchasePrice").value);
var closingCosts = parseFloat(document.getElementById("closingCosts").value);
var downPayment = parseFloat(document.getElementById("downPayment").value);
var interestRate = parseFloat(document.getElementById("interestRate").value);
var loanTerm = parseFloat(document.getElementById("loanTerm").value);
var monthlyRent = parseFloat(document.getElementById("monthlyRent").value);
var annualTaxes = parseFloat(document.getElementById("annualTaxes").value);
var annualInsurance = parseFloat(document.getElementById("annualInsurance").value);
var annualMaintenance = parseFloat(document.getElementById("annualMaintenance").value);
var errorMsg = document.getElementById("error-message");
var resultDiv = document.getElementById("roi-results");
// 2. Validation
if (isNaN(purchasePrice) || isNaN(closingCosts) || isNaN(downPayment) ||
isNaN(interestRate) || isNaN(loanTerm) || isNaN(monthlyRent) ||
isNaN(annualTaxes) || isNaN(annualInsurance) || isNaN(annualMaintenance)) {
errorMsg.style.display = "block";
resultDiv.style.display = "none";
return;
}
errorMsg.style.display = "none";
// 3. Logic Implementation
// Loan Amount
var loanAmount = purchasePrice – downPayment;
// Mortgage Calculation (Monthly PI)
// Formula: M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1 ]
var monthlyRate = (interestRate / 100) / 12;
var numberOfPayments = loanTerm * 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);
}
// Monthly Expenses (Tax + Insurance + Maintenance / 12)
var monthlyTax = annualTaxes / 12;
var monthlyIns = annualInsurance / 12;
var monthlyMaint = annualMaintenance / 12;
var totalMonthlyExpenses = monthlyMortgage + monthlyTax + monthlyIns + monthlyMaint;
// Cash Flow
var monthlyCashFlow = monthlyRent – totalMonthlyExpenses;
var annualCashFlow = monthlyCashFlow * 12;
// NOI (Net Operating Income) = Annual Income – Operating Expenses (Excluding Debt Service)
var annualOperatingExpenses = annualTaxes + annualInsurance + annualMaintenance;
var annualGrossIncome = monthlyRent * 12;
var noi = annualGrossIncome – annualOperatingExpenses;
// Cap Rate = (NOI / Purchase Price) * 100
var capRate = (noi / purchasePrice) * 100;
// Cash on Cash Return = (Annual Cash Flow / Total Cash Invested) * 100
var totalCashInvested = downPayment + closingCosts;
var cashOnCash = 0;
if (totalCashInvested > 0) {
cashOnCash = (annualCashFlow / totalCashInvested) * 100;
}
// 4. Update UI
document.getElementById("res-mortgage").innerHTML = "$" + monthlyMortgage.toFixed(2);
document.getElementById("res-expenses").innerHTML = "$" + totalMonthlyExpenses.toFixed(2);
var cashFlowEl = document.getElementById("res-cashflow");
cashFlowEl.innerHTML = "$" + monthlyCashFlow.toFixed(2);
cashFlowEl.style.color = monthlyCashFlow >= 0 ? "#27ae60" : "#c0392b";
document.getElementById("res-noi").innerHTML = "$" + noi.toFixed(2);
document.getElementById("res-caprate").innerHTML = capRate.toFixed(2) + "%";
var cocEl = document.getElementById("res-coc");
cocEl.innerHTML = cashOnCash.toFixed(2) + "%";
cocEl.style.color = cashOnCash >= 0 ? "#27ae60" : "#c0392b";
// Show results
resultDiv.style.display = "block";
}
Understanding Your Rental Property ROI
Investing in real estate is a powerful way to build wealth, but not every property is a good deal. To ensure profitability, investors rely on specific metrics to evaluate performance. This Rental Property ROI Calculator helps you analyze the potential returns of a real estate investment by breaking down cash flow, Cap Rate, and Cash on Cash Return.
What is Cash Flow?
Cash flow is the net amount of cash moving in and out of your investment business. In real estate terms, it is the money left over after all expenses—including the mortgage, taxes, insurance, and maintenance—are paid. Positive cash flow ensures the property pays for itself and generates passive income.
Cap Rate (Capitalization Rate) Explained
The Capitalization Rate, or Cap Rate, is a fundamental metric used to compare the profitability of different real estate investments. It is calculated by dividing the Net Operating Income (NOI) by the property's purchase price.
Formula: Cap Rate = (Net Operating Income / Purchase Price) × 100
Note that Cap Rate does not account for mortgage financing; it measures the natural return of the property as if you bought it with cash. A higher Cap Rate generally indicates a higher potential return, though it may come with higher risk.
Cash on Cash Return
Unlike Cap Rate, Cash on Cash Return considers financing. It measures the annual cash income earned on the actual cash invested (your down payment plus closing costs).
Why it matters: It tells you how hard your specific dollar is working.