function calculateCashFlow() {
// 1. Get Input Values
var price = parseFloat(document.getElementById('purchasePrice').value);
var downPaymentPercent = parseFloat(document.getElementById('downPayment').value);
var interestRate = parseFloat(document.getElementById('interestRate').value);
var termYears = parseFloat(document.getElementById('loanTerm').value);
var rent = parseFloat(document.getElementById('monthlyRent').value);
var taxYearly = parseFloat(document.getElementById('propertyTax').value);
var insuranceYearly = parseFloat(document.getElementById('insurance').value);
var maintenanceMonthly = parseFloat(document.getElementById('otherExpenses').value);
// Validate inputs
if (isNaN(price) || isNaN(downPaymentPercent) || isNaN(interestRate) || isNaN(termYears) || isNaN(rent)) {
alert("Please fill in all required fields with valid numbers.");
return;
}
// 2. Mortgage Calculation
var downPaymentAmount = price * (downPaymentPercent / 100);
var loanAmount = price – downPaymentAmount;
var monthlyRate = (interestRate / 100) / 12;
var numberOfPayments = termYears * 12;
var monthlyMortgage = 0;
if (interestRate === 0) {
monthlyMortgage = loanAmount / numberOfPayments;
} else {
monthlyMortgage = loanAmount * (monthlyRate * Math.pow(1 + monthlyRate, numberOfPayments)) / (Math.pow(1 + monthlyRate, numberOfPayments) – 1);
}
// 3. Expense Calculations
var monthlyTax = taxYearly / 12;
var monthlyInsurance = insuranceYearly / 12;
var totalMonthlyExpenses = monthlyTax + monthlyInsurance + maintenanceMonthly + monthlyMortgage;
var operatingExpenses = monthlyTax + monthlyInsurance + maintenanceMonthly; // Excluding mortgage for NOI
// 4. Profitability Metrics
var monthlyNOI = rent – operatingExpenses;
var monthlyCashFlow = rent – totalMonthlyExpenses;
var annualCashFlow = monthlyCashFlow * 12;
var annualNOI = monthlyNOI * 12;
// Cash on Cash Return = Annual Cash Flow / Total Cash Invested (Down Payment)
// Note: Simplified to just down payment. Could include closing costs if added to inputs.
var cashOnCash = (annualCashFlow / downPaymentAmount) * 100;
// Cap Rate = Annual NOI / Purchase Price
var capRate = (annualNOI / price) * 100;
// 5. Update UI
document.getElementById('resMortgage').innerText = "$" + monthlyMortgage.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
document.getElementById('resExpenses').innerText = "$" + totalMonthlyExpenses.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
document.getElementById('resNOI').innerText = "$" + monthlyNOI.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
var cfElement = document.getElementById('resCashFlow');
cfElement.innerText = "$" + monthlyCashFlow.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
// Style adjustments for negative flow
if (monthlyCashFlow < 0) {
cfElement.classList.add('rp-negative');
cfElement.classList.remove('rp-highlight');
} else {
cfElement.classList.remove('rp-negative');
cfElement.classList.add('rp-highlight');
}
document.getElementById('resCoC').innerText = cashOnCash.toFixed(2) + "%";
document.getElementById('resCapRate').innerText = capRate.toFixed(2) + "%";
// Show results container
document.getElementById('resultsSection').style.display = 'block';
}
Understanding Rental Property Cash Flow
Investing in real estate is one of the most reliable ways to build wealth, but the success of an investment property hinges on the numbers. Our Rental Property Cash Flow Calculator helps you determine whether a potential property is a sound financial decision or a money pit.
What is Cash Flow?
Cash flow is the net amount of cash moving into or out of your investment business. In rental real estate, positive cash flow means the rental income exceeds all expenses, including the mortgage, taxes, insurance, and maintenance. Negative cash flow means you are losing money every month to hold the property.
Key Metrics Explained
Net Operating Income (NOI): This is your annual income minus operating expenses (like taxes and repairs) but before mortgage payments. It measures the profitability of the property itself, regardless of financing.
Cash on Cash Return (CoC): This metric calculates the cash income earned on the cash invested. It is calculated by dividing the annual pre-tax cash flow by the total cash invested (usually the down payment plus closing costs). A CoC return of 8-12% is often considered good in many markets.
Cap Rate (Capitalization Rate): The ratio of Net Operating Income to the property's asset value. It helps compare the profitability of different properties without considering the financing method.
How to Use This Calculator
To get the most accurate results, ensure you estimate expenses conservatively. Don't forget to account for:
Vacancy Rates: Properties won't be rented 100% of the time. Setting aside 5-10% of rent for vacancies is a prudent safety net.
Maintenance & Repairs: Even new homes require upkeep. Budgeting 1% of the property value per year or 10% of rental income is standard practice.
Property Management: If you plan to hire a manager, deduct 8-10% of the monthly rent.
By inputting realistic numbers for purchase price, loan terms, and operating costs, you can forecast your monthly income and make data-driven investment decisions.