function calculateROI() {
// 1. Get Inputs
var price = parseFloat(document.getElementById("purchasePrice").value) || 0;
var down = parseFloat(document.getElementById("downPayment").value) || 0;
var closing = parseFloat(document.getElementById("closingCosts").value) || 0;
var rate = parseFloat(document.getElementById("interestRate").value) || 0;
var term = parseFloat(document.getElementById("loanTerm").value) || 0;
var rent = parseFloat(document.getElementById("monthlyRent").value) || 0;
var expenses = parseFloat(document.getElementById("monthlyExpenses").value) || 0;
// 2. Calculate Mortgage
var loanAmount = price – down;
var monthlyRate = (rate / 100) / 12;
var numPayments = term * 12;
var monthlyMortgage = 0;
if (loanAmount > 0) {
if (rate === 0) {
monthlyMortgage = loanAmount / numPayments;
} else {
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numPayments)) / (Math.pow(1 + monthlyRate, numPayments) – 1);
}
}
// 3. Calculate Key Metrics
var totalMonthlyCosts = monthlyMortgage + expenses;
var monthlyCashFlow = rent – totalMonthlyCosts;
var annualCashFlow = monthlyCashFlow * 12;
var noi = (rent – expenses) * 12; // Net Operating Income (exclude debt service)
var totalInvestment = down + closing;
var capRate = 0;
if (price > 0) {
capRate = (noi / price) * 100;
}
var cocReturn = 0;
if (totalInvestment > 0) {
cocReturn = (annualCashFlow / totalInvestment) * 100;
}
// 4. Update UI
document.getElementById("resMortgage").innerText = formatCurrency(monthlyMortgage);
var cfEl = document.getElementById("resCashFlow");
cfEl.innerText = formatCurrency(monthlyCashFlow);
if (monthlyCashFlow >= 0) {
cfEl.className = "result-value highlight-positive";
} else {
cfEl.className = "result-value highlight-negative";
}
document.getElementById("resNOI").innerText = formatCurrency(noi);
document.getElementById("resCapRate").innerText = capRate.toFixed(2) + "%";
var cocEl = document.getElementById("resCoC");
cocEl.innerText = cocReturn.toFixed(2) + "%";
if (cocReturn >= 0) {
cocEl.style.color = "#27ae60";
} else {
cocEl.style.color = "#c0392b";
}
// Show results
document.getElementById("results").style.display = "block";
}
function formatCurrency(num) {
return "$" + num.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
Understanding Rental Property ROI
Investing in real estate is one of the most reliable ways to build wealth, but simply buying a property doesn't guarantee profit. To succeed, investors must rigorously analyze the numbers before signing a contract. This Rental Property ROI (Return on Investment) Calculator is designed to help you analyze the potential profitability of a residential rental property by calculating key metrics like Cash Flow, Cap Rate, and Cash on Cash Return.
Key Metrics Explained
1. Cash Flow
Cash flow is the net amount of cash moving in and out of your investment each month. It is calculated by taking your total monthly rental income and subtracting all expenses, including the mortgage payment, taxes, insurance, and maintenance costs. Positive cash flow means the property pays for itself and puts money in your pocket every month, which is the primary goal for most buy-and-hold investors.
2. Cash on Cash Return (CoC)
This is arguably the most important metric for rental investors. It measures the annual return on the actual cash you invested (Down Payment + Closing Costs), rather than the total price of the property. For example, if you invest $50,000 cash to buy a $250,000 home and it generates $5,000 in annual profit, your Cash on Cash return is 10%. This metric allows you to compare real estate returns directly against other investment vehicles like stocks or bonds.
3. Cap Rate (Capitalization Rate)
Cap Rate measures the property's natural rate of return assuming you bought it with all cash (no loan). It is calculated by dividing the Net Operating Income (NOI) by the purchase price. Cap Rate is excellent for comparing the profitability of similar properties in the same market, irrespective of how they are financed.
How to Use This Calculator
To get the most accurate results, ensure you input realistic data:
Purchase Price: The agreed-upon price of the property.
Down Payment: The cash amount you are paying upfront. A higher down payment reduces your mortgage but increases your initial cash outlay.
Monthly Expenses: Do not underestimate this! Include Property Taxes, Landlord Insurance, HOA fees, Property Management fees (usually 8-10% of rent), and a reserve for maintenance and vacancy (typically 10-15% of rent).
By adjusting the "Monthly Rental Income" and "Purchase Price" fields, you can determine the maximum offer price that still yields your target ROI.