Rental Property Depreciation Calculator
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f9;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.form-container {
background-color: #fff;
padding: 20px;
box-shadow: 0 0 15px rgba(0,0,0,0.1);
border-radius: 8px;
}
input, select, button {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ddd;
border-radius: 5px;
box-sizing: border-box;
}
button {
background-color: #007BFF;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.result-container {
display: none;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 15px rgba(0,0,0,0.1);
border-radius: 8px;
margin-top: 30px;
}
.chart-container {
display: block;
margin-top: 40px;
}
.chart-container canvas {
width: 100%;
height: 300px;
}
Rental Property Depreciation Calculator
Depreciation Calculation Results
Annual Depreciation ($):
Total Depreciation Over Time ($):
Tax Savings from Depreciation ($):
Depreciation Over Time
function calculateDepreciation() {
// Get input values
const purchasePrice = parseFloat(document.getElementById('purchasePrice').value);
const landValue = parseFloat(document.getElementById('landValue').value);
const usefulLife = parseFloat(document.getElementById('usefulLife').value);
const taxBracket = parseFloat(document.getElementById('taxBracket').value);
// Validate inputs
if (isNaN(purchasePrice) || isNaN(landValue) || isNaN(usefulLife) || isNaN(taxBracket)) {
alert("Please enter valid values for all fields.");
return;
}
// Calculate depreciable amount (purchase price minus land value)
const depreciableValue = purchasePrice - landValue;
// Annual depreciation (straight-line method)
const annualDepreciation = depreciableValue / usefulLife;
// Total depreciation over useful life
const totalDepreciation = annualDepreciation * usefulLife;
// Tax savings due to depreciation
const taxSavings = annualDepreciation * (taxBracket / 100);
// Display results
document.getElementById('annualDepreciation').innerText = annualDepreciation.toFixed(2);
document.getElementById('totalDepreciation').innerText = totalDepreciation.toFixed(2);
document.getElementById('taxSavings').innerText = taxSavings.toFixed(2);
// Show results section
document.getElementById('results').style.display = 'block';
// Create depreciation chart data
const depreciationData = {
labels: Array.from({ length: usefulLife }, (v, k) => `Year ${k + 1}`),
datasets: [{
label: 'Depreciation ($)',
data: Array.from({ length: usefulLife }, () => annualDepreciation),
backgroundColor: 'rgba(54, 162, 235, 0.6)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}]
};
// Create chart
const ctx = document.getElementById('depreciationChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: depreciationData,
options: {
responsive: true,
plugins: {
title: {
display: true,
text: 'Depreciation Over Time'
},
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Depreciation ($)'
}
}
}
}
});
}