function calculateCashFlow() {
// 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 years = parseFloat(document.getElementById('loanTerm').value) || 30;
var rent = parseFloat(document.getElementById('monthlyRent').value) || 0;
var vacancyPct = parseFloat(document.getElementById('vacancyRate').value) || 0;
var annualTax = parseFloat(document.getElementById('propertyTax').value) || 0;
var annualIns = parseFloat(document.getElementById('insurance').value) || 0;
var monthlyHOA = parseFloat(document.getElementById('hoa').value) || 0;
var maintPct = parseFloat(document.getElementById('maintenance').value) || 0;
var capexPct = parseFloat(document.getElementById('capex').value) || 0;
// 2. Calculate Mortgage (Principal and Interest)
var loanAmount = price – down;
var monthlyRate = (rate / 100) / 12;
var totalMonths = years * 12;
var monthlyPI = 0;
if (rate > 0 && loanAmount > 0) {
monthlyPI = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, totalMonths)) / (Math.pow(1 + monthlyRate, totalMonths) – 1);
} else if (loanAmount > 0) {
monthlyPI = loanAmount / totalMonths;
}
// 3. Calculate Income Adjusted for Vacancy
var vacancyCost = rent * (vacancyPct / 100);
var effectiveGrossIncome = rent – vacancyCost;
// 4. Calculate Operating Expenses
var monthlyTax = annualTax / 12;
var monthlyIns = annualIns / 12;
var monthlyMaint = rent * (maintPct / 100);
var monthlyCapEx = rent * (capexPct / 100);
// Total Operating Expenses (Excluding Mortgage for NOI)
var operatingExpenses = monthlyTax + monthlyIns + monthlyHOA + monthlyMaint + monthlyCapEx + vacancyCost;
// Total Cash Outflow (Includes Mortgage)
var totalExpenses = operatingExpenses + monthlyPI – vacancyCost; // Vacancy is an income deduction usually, but for cash flow checks we sum outflows.
// Let's stick to Standard: Cash Flow = (Rent – Vacancy) – (OpEx + Mortgage)
var totalOutflow = (monthlyTax + monthlyIns + monthlyHOA + monthlyMaint + monthlyCapEx) + monthlyPI;
// 5. Results
var cashFlow = effectiveGrossIncome – (monthlyTax + monthlyIns + monthlyHOA + monthlyMaint + monthlyCapEx + monthlyPI);
var annualNOI = (effectiveGrossIncome – (monthlyTax + monthlyIns + monthlyHOA + monthlyMaint + monthlyCapEx)) * 12;
var totalCashInvested = down + closing;
var annualCashFlow = cashFlow * 12;
var cocReturn = 0;
if (totalCashInvested > 0) {
cocReturn = (annualCashFlow / totalCashInvested) * 100;
}
var capRate = 0;
if (price > 0) {
capRate = (annualNOI / price) * 100;
}
// 6. Formatting Helper
function formatMoney(num) {
return '$' + num.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
}
function formatPct(num) {
return num.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2}) + '%';
}
// 7. Update DOM
document.getElementById('resMortgage').innerText = formatMoney(monthlyPI);
document.getElementById('resIncome').innerText = formatMoney(effectiveGrossIncome);
document.getElementById('resExpenses').innerText = formatMoney(totalOutflow);
var cfElement = document.getElementById('resCashFlow');
cfElement.innerText = formatMoney(cashFlow);
if (cashFlow >= 0) {
cfElement.className = "result-value positive-cashflow";
} else {
cfElement.className = "result-value negative-cashflow";
}
document.getElementById('resNOI').innerText = formatMoney(annualNOI);
document.getElementById('resCoC').innerText = formatPct(cocReturn);
document.getElementById('resCapRate').innerText = formatPct(capRate);
document.getElementById('results-area').style.display = 'block';
}
How to Analyze a Rental Property Investment
Investing in real estate is a powerful way to build wealth, but simply buying a property and renting it out doesn't guarantee a profit. Professional investors use specific metrics to determine if a property is an asset or a liability. Our Rental Property Cash Flow Calculator helps you crunch the numbers before you make an offer.
Understanding the Key Metrics
1. Monthly Cash Flow
This is the net amount of money putting into your pocket each month after all expenses are paid. It is calculated as:
Total Income (Rent – Vacancy Loss)
Minus Operating Expenses (Taxes, Insurance, HOA, Repairs)
Minus Debt Service (Your Mortgage Payment)
A positive cash flow ensures the property pays for itself and provides you with passive income. A negative cash flow means you are feeding the property from your own pocket every month.
2. Cash on Cash Return (CoC ROI)
While cash flow tells you the dollar amount you make, Cash on Cash Return tells you how hard your money is working. It compares your annual cash flow to the actual cash you invested (Down Payment + Closing Costs).
Example: If you invest $50,000 cash and make $5,000 a year in profit, your CoC return is 10%. This allows you to compare real estate returns against stocks or bonds.
3. Net Operating Income (NOI)
NOI calculates the profitability of the property irrespective of the mortgage. It is Total Income minus Operating Expenses. Lenders look at NOI to determine if the property generates enough income to cover the loan payments (Debt Service Coverage Ratio).
Hidden Expenses to Watch For
Novice investors often overestimate profit by forgetting "silent" expenses. When using this calculator, ensure you estimate:
Vacancy Rate: No property is rented 100% of the time. A 5% vacancy rate assumes the unit is empty for about 18 days a year.
CapEx (Capital Expenditures): This is saving for big ticket items like a new roof or HVAC system that occur every 10-20 years.
Maintenance: Routine fixes like leaky faucets or broken blinds usually cost 5-10% of the monthly rent.
The 1% Rule
A quick "rule of thumb" used by investors is the 1% Rule. It states that the monthly rent should be at least 1% of the purchase price. For example, a $200,000 home should rent for at least $2,000/month. While not a strict law, properties that meet this rule are more likely to generate positive cash flow.