function calculateROI() {
// 1. Get Input Values
var price = parseFloat(document.getElementById('propPrice').value) || 0;
var downPercent = parseFloat(document.getElementById('downPayment').value) || 0;
var interestRate = parseFloat(document.getElementById('interestRate').value) || 0;
var years = parseFloat(document.getElementById('loanTerm').value) || 0;
var closing = parseFloat(document.getElementById('closingCosts').value) || 0;
var rent = parseFloat(document.getElementById('rentIncome').value) || 0;
var annualTax = parseFloat(document.getElementById('propTax').value) || 0;
var annualIns = parseFloat(document.getElementById('propIns').value) || 0;
var hoa = parseFloat(document.getElementById('hoaFee').value) || 0;
var maint = parseFloat(document.getElementById('maintenance').value) || 0;
// 2. Calculate Mortgage Details
var downAmount = price * (downPercent / 100);
var loanAmount = price – downAmount;
var monthlyRate = (interestRate / 100) / 12;
var numPayments = years * 12;
// Mortgage P&I Calculation (Standard Amortization Formula)
var monthlyPI = 0;
if (interestRate === 0) {
monthlyPI = loanAmount / numPayments;
} else {
monthlyPI = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numPayments)) / (Math.pow(1 + monthlyRate, numPayments) – 1);
}
if (isNaN(monthlyPI) || !isFinite(monthlyPI)) {
monthlyPI = 0;
}
// 3. Calculate Expenses
var monthlyTax = annualTax / 12;
var monthlyIns = annualIns / 12;
var totalMonthlyFixedExpenses = monthlyTax + monthlyIns + hoa + maint;
var totalMonthlyExpenses = monthlyPI + totalMonthlyFixedExpenses;
// 4. Calculate Income & Cash Flow
var noiMonthly = rent – totalMonthlyFixedExpenses;
var noiAnnual = noiMonthly * 12;
var cashFlowMonthly = rent – totalMonthlyExpenses;
var cashFlowAnnual = cashFlowMonthly * 12;
// 5. Calculate Returns
var totalInitialInvestment = downAmount + closing;
var cocReturn = 0;
if (totalInitialInvestment > 0) {
cocReturn = (cashFlowAnnual / totalInitialInvestment) * 100;
}
var capRate = 0;
if (price > 0) {
capRate = (noiAnnual / price) * 100;
}
// 6. Display Results
document.getElementById('resultsArea').style.display = 'block';
document.getElementById('resTotalInvested').innerText = '$' + totalInitialInvestment.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resMortgage').innerText = '$' + monthlyPI.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resTotalExpenses').innerText = '$' + totalMonthlyExpenses.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('resNOI').innerText = '$' + noiMonthly.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
var cfElem = document.getElementById('resCashFlow');
cfElem.innerText = '$' + cashFlowMonthly.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
if(cashFlowMonthly >= 0) {
cfElem.className = 'roi-metric';
} else {
cfElem.className = 'roi-metric negative';
}
var cocElem = document.getElementById('resCocReturn');
cocElem.innerText = cocReturn.toFixed(2) + '%';
if(cocReturn >= 0) {
cocElem.className = 'roi-metric';
} else {
cocElem.className = 'roi-metric negative';
}
document.getElementById('resCapRate').innerText = capRate.toFixed(2) + '%';
}
Understanding Rental Property ROI: Cash on Cash Return & Cap Rate
Investing in real estate is one of the most reliable ways to build wealth, but simply buying a property and renting it out doesn't guarantee a profit. To succeed, successful investors rely on specific financial metrics to evaluate whether a property is a "deal" or a "dud." The two most critical metrics are Cash on Cash Return (CoC) and Capitalization Rate (Cap Rate).
What is Cash on Cash Return?
Cash on Cash Return is essentially the return on the actual cash you invested, not the total price of the property. This is the most practical metric for investors using leverage (mortgages) because it tells you how hard your specific dollars are working.
For example, if you buy a $250,000 house with $50,000 down and $8,000 in closing costs, your total investment is $58,000. If the property generates $4,000 in positive cash flow per year after all expenses (mortgage, taxes, insurance, repairs), your Cash on Cash return is ($4,000 / $58,000) = 6.9%. This allows you to compare real estate returns directly against stock market yields or bond rates.
Understanding Cap Rate (Capitalization Rate)
While Cash on Cash return focuses on your specific financing setup, the Cap Rate measures the property's natural profitability regardless of how it is paid for. It represents the return on investment if you paid 100% cash.
The formula is:
Cap Rate = (Net Operating Income / Purchase Price) × 100
Net Operating Income (NOI) is your total rental income minus all operating expenses (taxes, insurance, HOA, maintenance) but excluding mortgage payments. Cap Rate is useful for comparing two different properties in the same market to see which is structurally a better earner.
Why Positive Cash Flow is King
The primary goal for most buy-and-hold investors is positive monthly cash flow. This is the profit left over after every single bill has been paid. Positive cash flow ensures the property pays for itself and provides you with passive income. As shown in our Rental Property ROI Calculator above, even a high-value property can have negative cash flow if the mortgage interest rate or operating expenses are too high relative to the rent charged.
How to Use This Calculator
This tool allows you to input granular details about a potential investment:
Purchase Price & Down Payment: Determines your loan size.
Closing Costs & Repairs: These are often overlooked but significantly impact your initial cash investment (the denominator in the CoC formula).
Operating Expenses: Be realistic. Always account for a "Vacancy/Maintenance" reserve. A common rule of thumb is setting aside 10-15% of monthly rent for repairs and vacancies, even if the property is currently new and occupied.
By adjusting these inputs, you can see how a slight increase in interest rates or a bump in property taxes affects your bottom line, helping you make data-driven investment decisions.