function calculateRental() {
// 1. Get Inputs using var
var price = parseFloat(document.getElementById('rpc_price').value) || 0;
var downPercent = parseFloat(document.getElementById('rpc_down').value) || 0;
var rate = parseFloat(document.getElementById('rpc_rate').value) || 0;
var term = parseFloat(document.getElementById('rpc_term').value) || 0;
var closingCosts = parseFloat(document.getElementById('rpc_closing').value) || 0;
var rent = parseFloat(document.getElementById('rpc_rent').value) || 0;
var vacancyPercent = parseFloat(document.getElementById('rpc_vacancy').value) || 0;
var taxAnnual = parseFloat(document.getElementById('rpc_tax').value) || 0;
var insuranceAnnual = parseFloat(document.getElementById('rpc_insurance').value) || 0;
var hoa = parseFloat(document.getElementById('rpc_hoa').value) || 0;
var maintPercent = parseFloat(document.getElementById('rpc_maint').value) || 0;
var pmPercent = parseFloat(document.getElementById('rpc_pm').value) || 0;
var capex = parseFloat(document.getElementById('rpc_capex').value) || 0;
// 2. Calculations
// Loan Calculations
var downPaymentAmount = price * (downPercent / 100);
var loanAmount = price – downPaymentAmount;
var monthlyRate = (rate / 100) / 12;
var numPayments = term * 12;
var monthlyMortgage = 0;
if (loanAmount > 0 && monthlyRate > 0) {
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numPayments)) / (Math.pow(1 + monthlyRate, numPayments) – 1);
} else if (loanAmount > 0 && rate === 0) {
monthlyMortgage = loanAmount / numPayments;
}
// Income Calculations
var grossMonthlyIncome = rent;
var vacancyLoss = grossMonthlyIncome * (vacancyPercent / 100);
var effectiveGrossIncome = grossMonthlyIncome – vacancyLoss;
// Expense Calculations
var taxMonthly = taxAnnual / 12;
var insuranceMonthly = insuranceAnnual / 12;
var maintCost = grossMonthlyIncome * (maintPercent / 100);
var pmCost = grossMonthlyIncome * (pmPercent / 100);
// Total Operating Expenses (excluding Mortgage)
var monthlyOperatingExpenses = taxMonthly + insuranceMonthly + hoa + maintCost + pmCost + capex;
// Net Operating Income (NOI)
var monthlyNOI = effectiveGrossIncome – monthlyOperatingExpenses;
var annualNOI = monthlyNOI * 12;
// Cash Flow
var monthlyTotalExpenses = monthlyOperatingExpenses + monthlyMortgage;
var monthlyCashFlow = effectiveGrossIncome – monthlyTotalExpenses;
var annualCashFlow = monthlyCashFlow * 12;
// Investment Returns
var totalInitialInvestment = downPaymentAmount + closingCosts;
var cashOnCash = 0;
if (totalInitialInvestment > 0) {
cashOnCash = (annualCashFlow / totalInitialInvestment) * 100;
}
var capRate = 0;
if (price > 0) {
capRate = (annualNOI / price) * 100;
}
// 3. Update DOM
var cfElement = document.getElementById('rpc_res_monthly_cf');
cfElement.innerText = formatCurrency(monthlyCashFlow);
// Change color based on positive/negative cashflow
if (monthlyCashFlow >= 0) {
cfElement.className = "rpc-result-value rpc-highlight";
} else {
cfElement.className = "rpc-result-value rpc-highlight rpc-highlight-neg";
}
document.getElementById('rpc_res_coc').innerText = cashOnCash.toFixed(2) + '%';
document.getElementById('rpc_res_cap').innerText = capRate.toFixed(2) + '%';
document.getElementById('rpc_res_noi').innerText = formatCurrency(annualNOI);
document.getElementById('rpc_res_mortgage').innerText = formatCurrency(monthlyMortgage);
document.getElementById('rpc_res_expenses').innerText = formatCurrency(monthlyTotalExpenses);
// Show results area
document.getElementById('rpc_results_area').style.display = 'block';
}
function formatCurrency(num) {
return '$' + num.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
Understanding Rental Property Cash Flow
Calculating cash flow is the fundamental step in evaluating a rental property investment. Positive cash flow ensures the property pays for itself while generating income for the investor, whereas negative cash flow implies the investor must contribute money monthly to keep the asset.
Key Metrics Explained
1. Monthly Cash Flow
This is your "take-home" profit after all expenses, including the mortgage. The formula used is:
A healthy cash flow provides a buffer against unexpected repairs and vacancies.
2. Cash on Cash Return (CoC)
Cash on Cash return measures the annual return on the actual cash you invested (down payment + closing costs), rather than the total loan amount. It is a critical metric for leverage.
Many investors aim for a CoC return between 8% and 12%, though this varies by market.
3. Cap Rate (Capitalization Rate)
Cap Rate measures the property's natural rate of return assuming you bought it with all cash (no mortgage). It allows you to compare properties regardless of financing.
Cap Rate = (Net Operating Income / Purchase Price) × 100
Estimating Expenses Correctly
The most common mistake novice investors make is underestimating expenses. Always account for:
Vacancy: Even in hot markets, tenants move out. A 5% vacancy rate (about 18 days a year) is a safe conservative estimate.
Maintenance: Setting aside 5-10% of rent for repairs is prudent. Roofs, HVACs, and water heaters eventually need replacement.
Property Management: Even if you self-manage, account for this cost (typically 8-10% of rent) to ensure the deal works if you eventually hire a manager.
How to Use This Calculator
Enter the specific details of your prospective property above. Start with the purchase price and financing details. Be realistic about the rental income—check local comps (comparables) on sites like Zillow or Rentometer. Finally, adjust your expense assumptions. The calculator will instantly update your Net Operating Income (NOI), Cap Rate, and Monthly Cash Flow to help you make an informed investment decision.