January
February
March
April
May
June
July
August
September
October
November
December
Annual Depreciation Expense
–
Depreciation Rate
–
Depreciable Base
–
Depreciation Schedule
Year
Opening Book Value
Depreciation Expense
Accumulated Depreciation
Ending Book Value
Understanding the Straight Line Depreciation Method
The Straight Line Depreciation method is the simplest and most commonly used accounting technique for allocating the cost of a tangible asset over its useful life. It assumes that the asset will lose value steadily and evenly over time, resulting in a constant depreciation expense amount each year.
This method is ideal for assets that provide uniform utility throughout their lifespan, such as office furniture, buildings, or simple machinery, rather than assets that lose value rapidly in early years (like vehicles or high-tech computers).
The Straight Line Formula
To calculate the annual depreciation expense, you need three key figures: the initial cost of the asset, its estimated salvage value (what you can sell it for at the end), and its useful life in years.
Additionally, the Depreciation Rate represents the percentage of the asset's depreciable cost that is expensed each year:
Depreciation Rate (%) = (1 / Useful Life) × 100
Input Definitions
Asset Cost (Basis): The total purchase price of the asset, including sales tax, shipping, installation, and testing fees required to get the asset ready for use.
Salvage Value: The estimated resale value of the asset at the end of its useful life. If you expect the asset to be worthless, this is $0.
Useful Life: The estimated number of years the asset will remain productive and in service for your business.
Calculation Example
Imagine a business purchases a delivery machine for $12,000. They expect to use it for 5 years and sell it for scrap for $2,000 at the end.
Depreciable Base: $12,000 – $2,000 = $10,000
Annual Expense: $10,000 / 5 years = $2,000 per year
Depreciation Rate: (1 / 5) = 20%
Every year for 5 years, the company will record a $2,000 expense, reducing the book value of the machine until it hits the $2,000 salvage value.
function calculateDepreciation() {
// 1. Get Input Values
var costInput = document.getElementById('assetCost');
var salvageInput = document.getElementById('salvageValue');
var lifeInput = document.getElementById('usefulLife');
var monthInput = document.getElementById('purchaseMonth');
var errorDiv = document.getElementById('errorMessage');
var resultsArea = document.getElementById('resultsArea');
var scheduleBody = document.getElementById('scheduleBody');
// 2. Parse values
var cost = parseFloat(costInput.value);
var salvage = parseFloat(salvageInput.value);
var life = parseFloat(lifeInput.value);
var startMonth = parseInt(monthInput.value);
// 3. Validation
if (isNaN(cost) || isNaN(salvage) || isNaN(life)) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = 'Please enter valid numbers for Cost, Salvage Value, and Useful Life.';
resultsArea.style.display = 'none';
return;
}
if (life cost) {
errorDiv.style.display = 'block';
errorDiv.innerHTML = 'Salvage value cannot be greater than the Asset Cost.';
resultsArea.style.display = 'none';
return;
}
// Hide error if validation passes
errorDiv.style.display = 'none';
resultsArea.style.display = 'block';
// 4. Core Calculations
var depreciableBase = cost – salvage;
var annualDepreciation = depreciableBase / life;
var rate = (1 / life) * 100;
var monthlyDepreciation = annualDepreciation / 12;
// 5. Display Summary Results
document.getElementById('annualDepreciationDisplay').innerHTML = formatMoney(annualDepreciation);
document.getElementById('depreciationRateDisplay').innerHTML = rate.toFixed(2) + '%';
document.getElementById('baseDisplay').innerHTML = formatMoney(depreciableBase);
// 6. Generate Schedule
scheduleBody.innerHTML = "; // Clear previous table
var currentBookValue = cost;
var accumulatedDepreciation = 0;
var yearCount = Math.ceil(life);
// Adjust for partial first year if not January
// If bought in Jan (1), full year. If bought in Dec (12), 1 month depreciation.
var monthsInFirstYear = 13 – startMonth;
var firstYearDepreciation = monthlyDepreciation * monthsInFirstYear;
// If start month is not January, we might have an extra year at the end
var totalLoopYears = (startMonth === 1) ? life : life + 1;
// However, for simplicity in standard straight line, we usually list fiscal years.
// We will calculate strictly based on the years passed.
// Logic for Schedule Generation
var expense = 0;
for (var i = 1; i <= Math.ceil(totalLoopYears); i++) {
var openingValue = currentBookValue;
if (i === 1) {
// First Year Logic
expense = (startMonth === 1) ? annualDepreciation : firstYearDepreciation;
} else if (i === Math.ceil(totalLoopYears) && startMonth !== 1) {
// Last partial year logic
var monthsInLastYear = 12 – monthsInFirstYear;
expense = monthlyDepreciation * monthsInLastYear;
} else {
// Middle full years
expense = annualDepreciation;
}
// Cap expense so we don't go below salvage value
// Check if this expense would push book value below salvage
if ((currentBookValue – expense) < salvage) {
expense = currentBookValue – salvage;
}
// Floating point correction
expense = parseFloat(expense.toFixed(2));
accumulatedDepreciation += expense;
currentBookValue -= expense;
// Ensure we don't show negative zero
if (currentBookValue < 0) currentBookValue = 0;
// Stop if book value equals salvage (and we've done the math)
// Note: We run the loop, but if expense is 0, we can stop or just show it.
var row = document.createElement('tr');
row.innerHTML =
'
' + i + '
' +
'
' + formatMoney(openingValue) + '
' +
'
' + formatMoney(expense) + '
' +
'
' + formatMoney(accumulatedDepreciation) + '
' +
'
' + formatMoney(currentBookValue) + '
';
scheduleBody.appendChild(row);
// Break loop if fully depreciated to salvage value
if (Math.abs(currentBookValue – salvage) = life) {
break;
}
}
}
function formatMoney(amount) {
return '$' + amount.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}