# Depreciation schedule

`depreciation-schedule` · version 1.0.0 · Financial calculations · free, no key needed

Straight-line, sum-of-years-digits, declining-balance and Excel DB depreciation schedule that ends at salvage.

**Use when you need to: depreciation schedule straight line · double declining balance depreciation · sum of the years digits depreciation table.**

## Decide before calling

Read the [versioned contract](/v1/tools/depreciation-schedule/versions/1.0.0) and the supported scope below. Reuse `depreciation-schedule@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `depreciation-schedule@1.0.0` for depreciation schedule straight line. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- depreciation schedule straight line
- double declining balance depreciation
- sum of the years digits depreciation table
- Excel DB fixed declining balance schedule
- asset book value by year
- depreciation with switch to straight line
- Excel SLN SYD DDB VDB equivalent
- fixed asset depreciation table with salvage value
- לוח פחת לנכס קבוע עם ערך גרט

## Not supported

- MACRS and other tax depreciation tables
- units-of-production, half-year and mid-quarter conventions
- loan or debt amortization (use loan-amortization-schedule)
- impairment, component depreciation and date-based calendars

## Behavior

- cost > 0 and 0 <= salvage <= cost are decimal strings (up to 20 integer and 20 fractional digits, no sign); both must have at most scale fractional digits, else invalid_input, so the ledger lives on the 10^-scale grid. life is a JSON integer of periods from 1; life above 600 is limit_exceeded (checked before other work except string bytes). method is required: straight-line, sum-of-years-digits, declining-balance or fixed-declining-balance.
- Optional fields and their meaning when omitted: factor (declining-balance only, 0 < factor <= 10) defaults to "2"; switch_to_straight_line (declining-balance only) defaults to false; first_year_months (fixed-declining-balance only, 1 to 12) defaults to 12. Supplying one of them for another method is invalid_input. scale defaults to 2, rate_scale to 6 (both 0 to 12) and rounding to half-up (half away from zero; also half-even, half-down, up, down, ceiling, floor).
- Exact schedule with C = cost, S = salvage, n = life, D = C - S, bv_k the exact book value after period k and A_k = C - bv_k the exact accumulated depreciation. straight-line: A_k = D*k/n. sum-of-years-digits (Excel SYD): A_k = D*k*(2n - k + 1)/(n*(n + 1)).
- declining-balance (Excel DDB, and VDB when switching): with r = factor/n, period k depreciates min(dd, bv_(k-1) - S) with dd = bv_(k-1)*r, or max(dd, (bv_(k-1) - S)/(n - k + 1)) when switch_to_straight_line is true; never below salvage and never negative. Without the switch the book value may stay above salvage (for example S = 0).
- fixed-declining-balance (Excel DB): rate3 = 1 - (S/C)^(1/n) rounded half-up to exactly 3 decimals regardless of rounding (determined exactly), and 1 when S = 0. With m = first_year_months there are n periods when m = 12 and n + 1 otherwise: period 1 is bv*rate3*m/12, periods 2 to n are bv*rate3, period n + 1 is bv_n*rate3*(12 - m)/12. Each period is capped at bv - S (Excel does not cap; a capped case is cost 1000, salvage 500, life 2: 207 instead of 207.151).
- Rounding is cumulative: a_k = round(A_k) at scale, depreciation_k = a_k - a_(k-1), accumulated_k = a_k and book_value_k = C - a_k. No depreciation is negative, the book value never falls below salvage, and a schedule that reaches salvage ends exactly there (1000 over 3 periods gives 333.33, 333.34, 333.33). This deliberately differs from rounding each period and correcting the last one.
- rows has one entry per period; total_depreciation and ending_book_value repeat the last row. rate is null for straight-line and sum-of-years-digits, factor/n for declining-balance and rate3 for fixed-declining-balance, rounded once to rate_scale (the computation uses the exact value). Exact BigInt arithmetic; outputs never contain -0.
- Any string input over 64 UTF-8 bytes is limit_exceeded, checked before parsing; a lone surrogate is invalid_input.
- Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice.

## Input

- `cost` (string, required): max length 64; pattern `^(0|[1-9][0-9]{0,19})(\.[0-9]{1,20})?$`
- `salvage` (string, required): max length 64; pattern `^(0|[1-9][0-9]{0,19})(\.[0-9]{1,20})?$`
- `life` (integer, required): min 1
- `method` (one of "straight-line", "sum-of-years-digits", "declining-balance", "fixed-declining-balance", required)
- `factor` (string, optional): max length 64; pattern `^(0|[1-9][0-9]{0,19})(\.[0-9]{1,20})?$`
- `switch_to_straight_line` (boolean, optional)
- `first_year_months` (integer, optional): min 1; max 12
- `scale` (integer, optional): min 0; max 12
- `rate_scale` (integer, optional): min 0; max 12
- `rounding` (one of "half-up", "half-even", "half-down", "up", "down", "ceiling", "floor", optional)

## Output

- `rows` (array of object, required): min items 1; max items 601
- `total_depreciation` (string, required): pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `ending_book_value` (string, required): pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `rate` (string or null, required): pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`

## Limits

- max string bytes: 64
- max life: 600

## Example

Request input:

```json
{
  "cost": "30000",
  "salvage": "7500",
  "life": 10,
  "method": "straight-line"
}
```

Response:

```json
{
  "result": {
    "rows": [
      {
        "period": 1,
        "depreciation": "2250.00",
        "accumulated": "2250.00",
        "book_value": "27750.00"
      },
      {
        "period": 2,
        "depreciation": "2250.00",
        "accumulated": "4500.00",
        "book_value": "25500.00"
      },
      {
        "period": 3,
        "depreciation": "2250.00",
        "accumulated": "6750.00",
        "book_value": "23250.00"
      },
      {
        "period": 4,
        "depreciation": "2250.00",
        "accumulated": "9000.00",
        "book_value": "21000.00"
      },
      {
        "period": 5,
        "depreciation": "2250.00",
        "accumulated": "11250.00",
        "book_value": "18750.00"
      },
      {
        "period": 6,
        "depreciation": "2250.00",
        "accumulated": "13500.00",
        "book_value": "16500.00"
      },
      {
        "period": 7,
        "depreciation": "2250.00",
        "accumulated": "15750.00",
        "book_value": "14250.00"
      },
      {
        "period": 8,
        "depreciation": "2250.00",
        "accumulated": "18000.00",
        "book_value": "12000.00"
      },
      {
        "period": 9,
        "depreciation": "2250.00",
        "accumulated": "20250.00",
        "book_value": "9750.00"
      },
      {
        "period": 10,
        "depreciation": "2250.00",
        "accumulated": "22500.00",
        "book_value": "7500.00"
      }
    ],
    "total_depreciation": "22500.00",
    "ending_book_value": "7500.00",
    "rate": null
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "depreciation-schedule",
  "version": "1.0.0",
  "input": {
    "cost": "30000",
    "salvage": "7500",
    "life": 10,
    "method": "straight-line"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/depreciation-schedule/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"cost":"30000","salvage":"7500","life":10,"method":"straight-line"}'
```

The machine-readable contract is at [/v1/tools/depreciation-schedule/versions/1.0.0](/v1/tools/depreciation-schedule/versions/1.0.0).

### CLI

```sh
node cli.mjs run depreciation-schedule 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Bond price from yield](/tools/bond-price-from-yield): Clean price, dirty price and accrued interest per 100 of a fixed-coupon bond from its yield (Excel PRICE, SIA).
- [Cashflow xnpv](/tools/cashflow-xnpv): NPV of dated cash flows with the Excel XNPV 365-day exponent and an explicit valuation date.
- [Loan amortization schedule](/tools/loan-amortization-schedule): Cent-exact level-payment loan schedule with per-period rounding, extra payments, dates and a row window.
- [Cashflow irr](/tools/cashflow-irr): IRR of equally spaced cash flows with every root reported, the chosen root named and no-solution cases signalled.
- [Cashflow mirr](/tools/cashflow-mirr): MIRR of periodic cash flows from a finance rate and a reinvestment rate, with compounded and discounted totals.
- [Cashflow npv](/tools/cashflow-npv): NPV of equally spaced cash flows, time-0 or Excel time-1, with inflow PV, outflow PV and profitability index.
