function calculateROI() {
// 1. Get Input Values
var price = parseFloat(document.getElementById('purchasePrice').value);
var downPmt = parseFloat(document.getElementById('downPayment').value);
var closing = parseFloat(document.getElementById('closingCosts').value);
var rate = parseFloat(document.getElementById('interestRate').value);
var term = parseFloat(document.getElementById('loanTerm').value);
var rent = parseFloat(document.getElementById('monthlyRent').value);
var tax = parseFloat(document.getElementById('annualTaxes').value);
var insurance = parseFloat(document.getElementById('annualInsurance').value);
var maint = parseFloat(document.getElementById('monthlyMaintenance').value);
// Validation
if (isNaN(price) || isNaN(downPmt) || isNaN(rent)) {
alert("Please enter valid numbers for Price, Down Payment, and Rent.");
return;
}
// 2. Loan Calculations
var loanAmount = price – downPmt;
var monthlyRate = (rate / 100) / 12;
var numPayments = term * 12;
var mortgagePayment = 0;
// If paying cash (0 loan or 0 term)
if (loanAmount <= 0 || term <= 0 || rate 0 && rate === 0) {
mortgagePayment = loanAmount / numPayments; // 0% interest logic
}
} else {
// Standard Amortization Formula: M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
mortgagePayment = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numPayments)) / (Math.pow(1 + monthlyRate, numPayments) – 1);
}
// 3. Expense Calculations
var monthlyTax = tax / 12;
var monthlyIns = insurance / 12;
var totalMonthlyExpenses = mortgagePayment + monthlyTax + monthlyIns + maint;
// 4. Profitability Metrics
var monthlyCashFlow = rent – totalMonthlyExpenses;
var annualCashFlow = monthlyCashFlow * 12;
// Net Operating Income (NOI) = (Revenue – Operating Expenses) *Excludes Mortgage*
// Operating Expenses = Tax + Insurance + Maintenance
var annualOperatingExpenses = tax + insurance + (maint * 12);
var annualRevenue = rent * 12;
var noi = annualRevenue – annualOperatingExpenses;
// Cap Rate = (NOI / Purchase Price) * 100
var capRate = (noi / price) * 100;
// Cash on Cash Return = (Annual Cash Flow / Total Cash Invested) * 100
var totalCashInvested = downPmt + closing;
var cocReturn = 0;
if (totalCashInvested > 0) {
cocReturn = (annualCashFlow / totalCashInvested) * 100;
}
// 5. Update UI
document.getElementById('resultsSection').style.display = 'block';
document.getElementById('resMortgage').innerText = '$' + mortgagePayment.toFixed(2);
document.getElementById('resExpenses').innerText = '$' + totalMonthlyExpenses.toFixed(2);
// Formatting for Cash Flow (Green for positive, Red for negative)
var cfElement = document.getElementById('resCashFlow');
cfElement.innerText = '$' + monthlyCashFlow.toFixed(2);
cfElement.style.color = monthlyCashFlow >= 0 ? '#27ae60' : '#c0392b';
document.getElementById('resNOI').innerText = '$' + noi.toFixed(2);
document.getElementById('resCapRate').innerText = capRate.toFixed(2) + '%';
var cocElement = document.getElementById('resCoC');
cocElement.innerText = cocReturn.toFixed(2) + '%';
cocElement.style.color = cocReturn >= 0 ? '#27ae60' : '#c0392b';
}
Understanding Your Investment: Rental Property ROI Guide
Investing in real estate is one of the most reliable ways to build wealth, but simply buying a property doesn't guarantee a profit. To succeed, investors must analyze the numbers with precision. Our Rental Property ROI Calculator helps you evaluate the potential profitability of an investment property by breaking down monthly cash flow, Cap Rate, and Cash on Cash Return.
Why You Need More Than Just "Price"
Many new investors look solely at the purchase price and the monthly rent, assuming that if rent is higher than the mortgage, they are making money. However, true investment analysis requires factoring in all expenses, including:
Vacancy Rates: The months where the property sits empty.
Maintenance & CapEx: Repairs and major replacements (like a new roof).
Operating Costs: Taxes, insurance, and HOA fees.
Key Metrics Explained
1. Monthly Cash Flow
Cash Flow is the net amount of money moving into or out of your pocket every month. It is calculated as Total Income minus Total Expenses (including your mortgage). Positive cash flow ensures the property pays for itself and provides passive income.
2. Cap Rate (Capitalization Rate)
The Cap Rate measures the natural rate of return of a property regardless of how it is financed. It is calculated by dividing the Net Operating Income (NOI) by the property's purchase price. This metric is essential for comparing the value of different properties directly, without the influence of loan terms.
Formula: Cap Rate = (Net Operating Income / Purchase Price) × 100
3. Cash on Cash Return (CoC ROI)
This is arguably the most important metric for investors using leverage (mortgages). It measures the return on the actual cash you invested (down payment + closing costs), rather than the total price of the home.
Example Scenario:
If you invest $50,000 cash (down payment) to buy a $200,000 property, and that property generates $5,000 in net annual cash flow: ($5,000 / $50,000) = 10% Cash on Cash Return.
What is a "Good" ROI?
While targets vary by market and strategy, many investors aim for:
Cash Flow: $100 – $300 per door, per month (net).
Cash on Cash Return: 8% to 12% or higher.
Cap Rate: 4% to 8% (depending on the risk level of the neighborhood).
Use the calculator above to adjust your offer price, down payment, or rental estimates to see how these changes impact your bottom line. Successful real estate investing is about finding the sweet spot where all these metrics align with your financial goals.