Fix and Flip Deal Analysis Calculator
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f9;
}
.container {
max-width: 1000px;
margin: 20px auto;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
input, select, button {
width: 100%;
padding: 10px;
margin: 10px 0;
font-size: 16px;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid #ddd;
}
h2, h3 {
color: #333;
}
.results {
display: none;
margin-top: 20px;
}
.result-item {
font-size: 18px;
margin-bottom: 10px;
}
#charts {
display: none;
}
canvas {
width: 100%;
max-width: 800px;
margin: 10px 0;
}
Fix and Flip Deal Analysis Calculator
Property Purchase and Rehab Costs
Financing Details
Sales and Profit Details
Results:
Total Project Cost: $
Rehab Cost per Square Foot: $
Total Loan Payments: $
Gross Profit: $
Net Profit: $
Return on Investment (ROI): %
Break-even Point (Months): months
Cap Rate (Annualized): %
Graphs
// Function to calculate the fix and flip deal analysis
function calculateFixAndFlip() {
const purchasePrice = parseFloat(document.getElementById('purchasePrice').value) || 0;
const rehabCosts = parseFloat(document.getElementById('rehabCosts').value) || 0;
const closingCosts = parseFloat(document.getElementById('closingCosts').value) || 0;
const holdingCosts = parseFloat(document.getElementById('holdingCosts').value) || 0;
const sellingCostsPercentage = parseFloat(document.getElementById('sellingCosts').value) / 100 || 0;
const loanAmount = parseFloat(document.getElementById('loanAmount').value) || 0;
const interestRate = parseFloat(document.getElementById('interestRate').value) / 100 || 0;
const loanTerm = parseFloat(document.getElementById('loanTerm').value) || 0;
const monthlyRent = parseFloat(document.getElementById('monthlyRent').value) || 0;
const arv = parseFloat(document.getElementById('arv').value) || 0;
const profitMargin = parseFloat(document.getElementById('profitMargin').value) / 100 || 0;
// Calculate total project cost
const totalProjectCost = purchasePrice + rehabCosts + closingCosts + holdingCosts;
// Calculate loan payments (using the loan amortization formula)
const monthlyInterestRate = interestRate / 12;
const numberOfPayments = loanTerm;
const loanPayment = loanAmount * (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments)) / (Math.pow(1 + monthlyInterestRate, numberOfPayments) - 1);
const totalLoanPayments = loanPayment * loanTerm;
// Calculate gross profit (sale price - total project cost)
const grossProfit = arv - totalProjectCost;
// Calculate net profit (gross profit - loan costs)
const sellingCosts = arv * sellingCostsPercentage;
const netProfit = grossProfit - totalLoanPayments - sellingCosts;
// Calculate ROI
const roi = netProfit / totalProjectCost * 100;
// Calculate break-even point
const breakEvenPoint = totalProjectCost / (monthlyRent || 1); // Avoid division by 0 if rent is 0
// Calculate Cap Rate
const capRate = (netProfit / arv) * 100;
// Display results
document.getElementById('totalProjectCost').textContent = totalProjectCost.toFixed(2);
document.getElementById('rehabCostPerSqFt').textContent = (rehabCosts / 100).toFixed(2); // Example: assume the property is 100 sq ft
document.getElementById('totalLoanPayments').textContent = totalLoanPayments.toFixed(2);
document.getElementById('grossProfit').textContent = grossProfit.toFixed(2);
document.getElementById('netProfit').textContent = netProfit.toFixed(2);
document.getElementById('roi').textContent = roi.toFixed(2);
document.getElementById('breakEvenPoint').textContent = breakEvenPoint.toFixed(2);
document.getElementById('capRate').textContent = capRate.toFixed(2);
// Show results
document.getElementById('results').style.display = 'block';
document.getElementById('charts').style.display = 'block';
// Update the graphs
updateGraphs(grossProfit, netProfit, breakEvenPoint);
}
// Function to update graphs with deal data
function updateGraphs(grossProfit, netProfit, breakEvenPoint) {
const profitData = {
labels: ['Gross Profit', 'Net Profit'],
datasets: [{
label: 'Profit Breakdown',
data: [grossProfit, netProfit],
backgroundColor: ['rgba(75, 192, 192, 0.7)', 'rgba(153, 102, 255, 0.7)'],
borderColor: ['rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)'],
borderWidth: 2
}]
};
const cashFlowData = {
labels: ['Month 1', 'Month 2', 'Month 3', 'Month 4', 'Month 5'],
datasets: [{
label: 'Cash Flow Over Time',
data: [netProfit / 5, netProfit / 5, netProfit / 5, netProfit / 5, netProfit / 5],
backgroundColor: 'rgba(255, 159, 64, 0.7)',
borderColor: 'rgba(255, 159, 64, 1)',
borderWidth: 3,
fill: false,
tension: 0.4
}]
};
// Destroy existing charts before creating new ones
if (window.profitChart) window.profitChart.destroy();
if (window.cashFlowChart) window.cashFlowChart.destroy();
// Create the profit breakdown bar chart
window.profitChart = new Chart(document.getElementById('profitGraph'), {
type: 'bar',
data: profitData,
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Profit ($)'
}
},
x: {
title: {
display: true,
text: 'Profit Type'
}
}
},
plugins: {
tooltip: {
callbacks: {
label: function(tooltipItem) {
return '$' + tooltipItem.raw.toFixed(2);
}
}
}
}
}
});
// Create the cash flow over time line chart
window.cashFlowChart = new Chart(document.getElementById('cashFlowGraph'), {
type: 'line',
data: cashFlowData,
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Cash Flow ($)'
}
},
x: {
title: {
display: true,
text: 'Months'
}
}
},
plugins: {
tooltip: {
callbacks: {
label: function(tooltipItem) {
return '$' + tooltipItem.raw.toFixed(2);
}
}
}
}
}
});
}