finance-business · personal-investing · alternatives-accounts

Crypto DCA Cost Basis Calculator

Enter your crypto purchases and the price today, and see your average cost, the units you hold, your gain or loss and how much of it is on purchases held more than one year, and compare selling a share of your units first in, first out, last in, first out or highest cost first. Then simulate a fixed purchase every 1, 2 or 4 weeks across 100 weekly price paths inside a seeded, reproducible workbook, and see the range of the plan's value by week and the chance that it ends below what it put in. Gains and holding periods, not the tax on them. Estimates for education, not advice.

Last updated

Calculator overview

Inputs and outputs

This summary comes from the calculator's published input and output contract.

Inputs

Yearly staking yield
When omitted Blank
About this input

The yearly staking yield your units earn, if any. Leave blank, or enter 0, if they earn none. It gives a yearly staking income at the price today; the rewards are not added to your units.

Unit % Default Not set Range 0 to 1
Share of your units to compare selling (required)
About this input

The share of the units you hold to sell in the method comparison, from 0% to 100%. The comparison takes the units oldest first (FIFO), newest first (LIFO) or highest price first (HIFO): HIFO sells the units that cost the most, so it gives the lowest gain, but those are often recent purchases held one year or less.

Unit % Default 0.5 Range 0 to 1
Shape of weekly returns (required)
About this input

The shape of weekly returns: Fat-tailed (a Student t, with more frequent extreme weeks than a normal curve) or Normal.

Default Fat-tailed Allowed Fat-tailed, Normal
Volatility (standard deviation of yearly returns) (required)
About this input

The standard deviation of yearly returns you assume, as a percentage. Crypto prices have often moved by 50% or more in a year; 70% is the example. It is spread over the 52 weeks of a year.

Unit % Default 0.7 Range 0 to 2
Date of the price today (required)
About this input

The date of the price today. It decides which purchases have been held more than one year: a purchase is held more than one year when this date is after the same day one year later, so one year to the day is still one year or less. It must be on or after your last purchase.

Unit date Default 2026-10-01
Tail heaviness (degrees of freedom) (required) Conditional
About this input

How heavy the tails of the weekly returns are, from 3 to 30 (the degrees of freedom of the Student t). Lower means more frequent extreme weeks; 4 is a common choice for crypto, and 30 is close to normal. Used only when the returns are fat-tailed.

Default 4 Range 3 to 30
Random seed
When omitted Blank
About this input

The starting number of the workbook's random-number generator, a whole number from 1 to 2,147,483,646. The same seed and inputs always give the same result, so passing a result's seed again reproduces it. Leave blank for 42, the seed of the published examples. The web page does not show this input: each Simulate press first sets it to the last result's next seed.

Default Not set Range 1 to 2147483646
Weeks to simulate (required)
About this input

How many weeks the plan from today runs, from 1 to 104 (two years). The plan value is read at the end of the last week.

Unit weeks Default 104 Range 1 to 104
Expected yearly return (average) (required)
About this input

The average yearly return you assume for the price, as a percentage. With normal returns the weekly growth is matched to this average and the volatility. With fat tails the same weekly pair is used with a Student t draw in place of the normal one, capped at 10 standard units: the typical (median) week is unchanged, and the simulated average week stays close to this average, within about 0.004% a week (about 0.2% a year) at the example's 70% volatility and tail heaviness 4, and within about 0.1% a week (up to about 4% a year) at the extremes of volatility and tail heaviness. The cap also puts the weekly spread slightly below the entered volatility, by an amount that depends on the tail heaviness (4.32% at a tail heaviness of 3, 0.740% at 4 and less above).

Unit % Default 0.1 Range -0.5 to 1
Price per unit today (required)
About this input

The price of one unit today, in dollars. Your units are valued at this price, and the plan from today starts buying at it.

Unit $ per unit Default 100 Range 1E-08 to 1000000000
Your purchases, oldest first (required)
About this input

Your purchases so far, oldest first from the first row, one row per purchase: the date you bought, the amount you paid in dollars and the price per unit you paid. Up to 200 purchases. Each row needs all three; the units bought are the amount over the price.

Default 12 rows
ColumnRange or allowed values
Date Not declared
Amount 1E-08 to 1000000000000
Price per unit 1E-08 to 1000000000
How often you buy (required)
About this input

How often the plan buys: every week, every 2 weeks or every 4 weeks. It buys at the start of the first week and then every 1, 2 or 4 weeks, but not in the last week.

Default Weekly Allowed Weekly, Every 2 weeks, Every 4 weeks
Amount per purchase (required)
About this input

The amount you would buy in each purchase of the plan from today, in dollars, from 1 dollar.

Unit $ Default 100 Range 1 to 1000000000000

Outputs

Workbook self-check
About this output

PASS when the workbook's model consistency checks hold for this result: the generator states in range and every grid complete, the capped draws within their bounds, the purchases, gains and holding periods adding up, each method selling exactly the units compared and HIFO giving the lowest gain, and every plan statistic consistent and in order. FAIL means the result should not be trusted; please report it.

No unit declared
Seed used
About this output

The seed this result used: the seed supplied, or 42 when left blank. Pass it again with the same inputs to reproduce this result exactly.

No unit declared
Part held one year or less, highest cost first
About this output

The part of the HIFO gain or loss on units held one year or less.

Unit $
Part held one year or less, FIFO
About this output

The part of the FIFO gain or loss on units held one year or less.

Unit $
90th percentile plan value at the end
About this output

The 90th percentile of the plan value at the end: a tenth of the simulated futures end above it.

Unit $
10th percentile plan value at the end
About this output

The 10th percentile of the plan value at the end: a tenth of the simulated futures end below it.

Unit $
Sampling error of the chance of ending below what you put in
About this output

About how far, in percentage points, this chance of ending below what you put in could sit from the chance that a very large number of futures would give: the 95 percent margin of a share estimated from this many futures, at its widest. 9.8 points at 100 futures. Two runs with different seeds are two such estimates, so the 95 percent range of their difference is wider, about 1.4 times this margin (13.9 points at 100 futures).

Unit percentage points
Plan value by week
About this output

The plan value by week at the 10th, 25th, 50th, 75th and 90th percentiles of the simulated futures, and what the plan has put in so far. The table behind the plan chart.

No unit declared
Part held one year or less, LIFO
About this output

The part of the LIFO gain or loss on units held one year or less.

Unit $
Gain or loss at the price today
About this output

The gain or loss on your units at the price today: their value today less the amount you paid. A negative figure is a loss. It is not realised until you sell.

Unit $
Units in the compared sale
About this output

The units in the compared sale: the share to sell times the units you hold.

Unit units
Gain or loss held one year or less
About this output

The part of the gain or loss today on purchases held one year or less.

Unit $
Gain or loss held more than one year
About this output

The part of the gain or loss today on purchases held more than one year.

Unit $
Amount invested
About this output

The total amount you paid for your purchases.

Unit $
Yearly staking income at the price today Conditional
About this output

A yearly staking income at the price today: your units times the staking yield times the price today. Staking rewards are generally included in income when you gain control of them, at their fair market value then; this figure is an estimate at today's price, not a tax amount.

Unit $/year
Units you hold
About this output

The units you hold: the sum of each purchase's amount over its price.

Unit units
Futures simulated
About this output

The number of futures this result simulated: always 100.

Unit trials
Gain or loss on the compared sale, LIFO
About this output

The gain or loss on selling the compared units newest first (LIFO).

Unit $
Gain or loss on the compared sale, highest cost first
About this output

The gain or loss on selling the compared units highest price first (HIFO, ties by date). It is never above the FIFO and LIFO gains.

Unit $
Your purchases at the price today
About this output

Your purchases at the price today, one row per purchase: the date, the units bought, the cost, the value today, the gain or loss, whether it has been held more than one year, and whether it was in profit on its date. The table behind the purchase and gain charts.

No unit declared
Share of your purchase dates on which you were in profit
About this output

The share of your purchase dates on which you were in profit: the purchase price was above your running average cost including that purchase. The first purchase equals its own average, so it never counts.

Unit %
Value of your units today
About this output

The value of your units at the price today.

Unit $
Your average cost per unit
About this output

Your average cost per unit: the total amount you paid over the total units you bought. Above it the price today puts your units in profit.

Unit $ per unit
Gain or loss on the compared sale, FIFO
About this output

The gain or loss on selling the compared units oldest first (FIFO): their value at the price today less what those units cost.

Unit $
Gain or loss on the compared sale, average cost
About this output

The gain or loss on the compared units at your average cost, shown for comparison only: US rules for digital assets generally identify the units sold by specific identification or first in, first out within each wallet or account, not by average cost.

Unit $
Selling a share of your units, by method
About this output

The compared sale by method: the units sold, their cost, the gain or loss, and how much of it is on units held one year or less and more than one year (not split for average cost, shown for comparison only).

No unit declared
Median units at the end
About this output

The median number of units the plan buys over the simulated futures.

Unit units
Total you put into the plan
About this output

The total the plan from today puts in: the number of purchases times the amount per purchase.

Unit $
Median plan value at the end
About this output

The median value of the plan at the end of the last week over the 100 simulated futures: half end above it.

Unit $
Plan value if every week grew at the expected return
About this output

The plan value at the end if every week grew at the expected return, with no ups and downs.

Unit $
Next seed in the same stream
About this output

A new seed from the same generator, the start of the next unused stretch of its sequence: a run with it draws fresh futures that share no draw with these. On the web page each Simulate press first enters it as the seed, except the first press after a worked example or Reset.

No unit declared
Model Status
About this output

Whether the inputs describe purchases and a plan the workbook can compute, any result to notice, or OK. The NOT VALID and CHECK reasons are listed in the methodology.

No unit declared
Median average cost at the end
About this output

The median average cost per unit the plan pays over the simulated futures: the total put in over the units bought, which is the harmonic mean of the purchase prices.

Unit $ per unit
Chance the plan ends worth less than you put in
About this output

The share of the 100 simulated futures in which the plan from today ends worth less than the total it put in.

Unit %
This page is provided by LogicCommons for informational purposes only. Results are model outputs computed from the inputs you supply and are not financial, investment, tax, accounting, or legal advice, and no advisory relationship is created. Verify all inputs and results independently before relying on them in any decision.

LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.

Methodology

Purpose and model boundary

This calculator has two parts that share one set of inputs. Your purchases so far takes the purchases you have made (each with its date, the amount you paid and the price per unit) and the price today. It reports your units, your average cost, the value and the gain or loss at the price today, how much of that gain is on purchases held more than one year, and the gain on selling a share of your units under three orders of sale. A plan from today simulates buying a fixed amount every 1, 2 or 4 weeks for up to two years, starting at the price today, across 100 possible weekly price paths. The main result is your average cost; the page also shows the chance that the plan ends worth less than it put in.

To compare putting a sum in at once against spreading it out, use the Dollar Cost Averaging vs Lump Sum Calculator; for the tax on a gain, use the Capital Gains Tax Calculator. This calculator shows gains and holding periods, not the tax on them.

The model is educational. It is not a prediction of prices or tax law, and it is not financial, investment, tax or legal advice.

Inputs and units

Enter your purchases oldest first from the first row, up to 200, each with a date, an amount in dollars and a price per unit in dollars. Enter the price today and its date, which must be on or after your last purchase. The optional staking yield is a yearly percentage; blank means none. The share to sell is a share of the units you hold, so the compared sale can never exceed your holdings.

For the plan, enter the amount per purchase (at least 1 dollar), how often you buy, and the number of weeks (1 to 104). The market assumptions are the expected yearly return, the volatility of yearly returns, the shape of weekly returns (fat-tailed or normal) and, for fat tails, the tail heaviness from 3 to 30.

The workbook always runs 100 futures. Its optional seed defaults to 42 for the worked examples. On the page, Simulate uses the last result's next seed before a repeated run, while the first run after a worked example or Reset uses that example's seed. API and MCP callers can supply a seed to reproduce a run.

Governing relationships

A purchase of an amount a at a price p buys a / p units. Your average cost is the total amount over the total units, which is the amount-weighted harmonic mean of your prices. The value today is your units times the price today, and the gain or loss is that value less what you paid.

A purchase is held more than one year when the date of the price today is after the same day one year after the purchase, so one year to the day is still one year or less. In the United States a gain on a capital asset held more than one year is generally long-term; the holding period starts the day after the purchase and includes the day of sale. A purchase counts as in profit on its date when its price was above your running average cost including it; the first purchase equals its own average, so it never counts, and a relative tolerance of 1E-12 keeps rounding from deciding.

The compared sale takes whole purchases in a fixed order, then part of one: oldest first (FIFO), newest first (LIFO) or highest price first (HIFO; ties by date, then by row). The units taken from a purchase are the smaller of its units and what is still to sell after the purchases ahead of it. The gain is the units sold times the price today less the cost of the units taken, split into the part held one year or less and the part held longer. Selling the highest-cost units first gives the lowest gain of the three, but those units are often recent. US rules for digital assets generally identify the units sold by specific identification or first in, first out, within each wallet or account; LIFO and highest-cost-first are ways of specifically identifying units. The average-cost row is shown for comparison only.

The staking income is a yearly estimate at the price today: your units times the staking yield times the price today. Staking rewards are generally included in income when you gain control of them, at their fair market value then; the figure is not a tax amount, and the rewards are not added to your units.

For the plan, one seeded generator gives each future two consecutive parts of its stream, enough for 104 weeks. Each week's draw becomes a growth factor G = exp(m + s·Z), where m and s are the yearly lognormal pair matched to the expected return and volatility, divided by 52 and √52. For normal returns Z is a standard normal draw. For fat-tailed returns Z is a Student t draw with the chosen degrees of freedom, scaled to unit variance and capped at ±10 standard units. The cap keeps the rare extreme weeks finite; it lowers the standard deviation of the weekly draw by an amount that depends on the tail heaviness, about 4.32% at 3, 0.740% at 4, 0.17% at 5 and less above, so the weekly spread sits slightly below the entered volatility. With fat tails the median weekly growth is the same as with normal returns, and the simulated average weekly growth stays close to the one the expected return implies: within about 0.004% a week (about 0.2% a year) at the example's 70% volatility and tail heaviness 4, and within about 0.1% a week (up to about 4% a year) at the extremes of volatility and tail heaviness, where the expected return is only approximately the simulated average.

The plan buys at the start of week 0 and then every 1, 2 or 4 weeks before the last week, at that week's price. Its value after week w is V(w) = V(w − 1)·G(w) + a·f(w), where f(w) is 1 in a buying week. The units bought are the final value over the final price, and their average cost is the total put in over the units.

Calculation sequence

The workbook first checks the purchases and the inputs, then computes each purchase, the holding periods and the three orders of sale, then simulates the 100 futures and derives the weekly percentiles and the results. A repeated Simulate action uses the last result's next seed before the new run.

Outputs and interpretation

The cards show your average cost, the units you hold, the gain or loss at the price today, the staking income when you enter a yield, and the chance that the plan ends below what it put in, with its sampling error. The tables show every purchase, the compared sale by method, and the plan value by week.

The purchase chart spaces its columns by purchase, not by calendar time, and ends with a Today column. The plan chart shows the 10th, 25th, median, 75th and 90th percentiles by week and what the plan has put in so far. The chance of ending below what was put in comes from 100 futures, so it is reported with a sampling error of about ±9.8 percentage points.

Validation and status logic

The workbook evaluates the conditions below from top to bottom and returns the first matching status. This is the workbook's priority order, including warnings that may accompany a computed result.

Priority Condition Returned status
1 A purchase row is partly filled NOT VALID: each purchase needs a date, an amount and a price
2 No purchase is entered, or an empty row sits between purchases NOT VALID: list your purchases from the first row, with no empty rows between them
3 A purchase date is not a date, is outside 1970 to 2099, or comes before the one above it NOT VALID: purchase dates must be valid dates, oldest first
4 The date of the price today is not a date, is outside 1970 to 2099, or is before the last purchase NOT VALID: the date of the price today must be a valid date on or after your last purchase
5 A purchase amount is not above 0 or above 1 trillion dollars, or a price is not above 0 or above 1 billion dollars NOT VALID: each purchase amount must be above 0 and at most 1 trillion dollars, and each price above 0 and at most 1 billion dollars
6 The price today is not above 0 or above 1 billion dollars NOT VALID: the price today must be above 0 and at most 1 billion dollars
7 The staking yield or the share to sell is outside 0% to 100% NOT VALID: the staking yield and the share to sell must be between 0% and 100%
8 The amount per purchase is outside 1 dollar to 1 trillion dollars NOT VALID: the amount per purchase must be from 1 dollar to 1 trillion dollars
9 The purchase frequency or the shape of returns is not one of the choices NOT VALID: choose how often you buy and the shape of returns from the lists
10 The weeks are not a whole number from 1 to 104 NOT VALID: the weeks to simulate must be a whole number from 1 to 104
11 The expected return is outside -50% to 100% a year NOT VALID: the expected return must be between -50% and 100% a year
12 The volatility is outside 0% to 200% a year NOT VALID: volatility must be between 0% and 200% a year
13 Returns are fat-tailed and the tail heaviness is not a whole number from 3 to 30 NOT VALID: the tail heaviness must be a whole number from 3 to 30
14 A supplied seed is not a whole number in the supported interval; blank uses the published default 42 NOT VALID: the random seed must be a whole number from 1 to 2,147,483,646
15 The 100-future simulation did not complete NOT VALID: the simulation did not complete; this is a defect in the workbook, please report it
16 The workbook's self-check fails CHECK: the self-check of the workbook failed for this result, so do not rely on it; please report it
17 Volatility is zero CHECK: volatility is 0, so every simulated future is the same and the chance of ending below what you put in can only be 0% or 100%
18 Fewer than 100 futures were simulated CHECK: fewer than 100 futures were simulated; this is a defect in the workbook, please report it
19 None of the preceding conditions applies OK

NOT VALID is a refusal, not a numeric answer. CHECK may accompany a computable result but calls for the stated review. The self-check is separately reported as arithmetic-integrity evidence; it does not replace this ordered status chain.

Assumptions and limitations

Prices and values are nominal. The model computes no tax amount, and it does not model purchase or sale fees, a price history to buy along, staking rewards added to your units, your current units carried into the plan, choosing individual purchases to sell, wallets tracked separately, wash sales, or losses carried forward. The plan uses one expected return and one volatility throughout; beyond the fat tails, it has no mean reversion or change of market regime. The simulated prices are illustrations of the assumptions you enter, not forecasts.

Restrictions and non-computing states

This calculator enforces its numeric and choice limits before it accepts a result. The tail heaviness is read only when returns are fat-tailed, so a value entered for normal returns never turns a scenario into NOT VALID; a retained seed remains part of every simulation.

Errors and warnings

A request rejected by the page's input limits is not a computed result. A transport or service failure cannot establish a fresh workbook answer. Review the workbook's References and Disclaimer and current tax rules with a qualified professional before using a result for a real decision.

References

Sources and further reading

The model's purchases, prices and return assumptions come from the inputs, not market data. The workbook's References sheet identifies the calculation sources. The links below explain the rules and methods the model follows; they do not endorse this calculator.

  • IRS Notice 2014-21 explains that virtual currency is treated as property for federal tax purposes, so a sale has a gain or loss measured against its basis (retrieved 2026-10-11).
  • IRS Revenue Ruling 2023-14 explains that staking rewards are generally included in income when you gain control of them, at their fair market value then (retrieved 2026-10-11). The calculator's staking income is an estimate at the price today, not a tax amount.
  • 26 U.S.C. § 1222 defines a long-term gain or loss as one on the sale or exchange of a capital asset held more than one year (retrieved 2026-10-11).
  • IRS Publication 544, "Holding Period", explains the counting: start on the day after you acquired the property, and include the day you disposed of it, so an asset sold on the same date one year after it was bought has not been held longer than one year (retrieved 2026-10-11).
  • 26 CFR § 1.1012-1(j), for digital assets acquired or disposed of on or after January 1, 2025: within each wallet or broker account, the units sold are those you specifically identify by the time of sale, otherwise the earliest acquired first (FIFO); identifying by earliest, latest or highest cost is not a method of accounting. Average basis under paragraph (e) is available only for fund shares and dividend-reinvestment-plan stock. The calculator's average-cost row is shown for comparison only (retrieved 2026-10-11).
  • S. K. Park and K. W. Miller, “Random number generators: good ones are hard to find,” Communications of the ACM 31(10), 1988, and the Park–Miller–Stockmeyer 1993 correspondence describe the generator family. The workbook uses multiplier 48,271 and modulus 2³¹ − 1.
  • The NIST/SEMATECH e-Handbook's lognormal and t distribution sections, and Microsoft Support's T.INV, NORM.S.INV and EDATE documentation, describe the distributions and date function the workbook uses.

This is an educational estimate, not financial, investment, tax or legal advice. Tax rules for digital assets change and depend on your situation; verify against current law and a qualified professional.

Results are informational and not professional advice. See our Terms of Use. Powered by SpreadsheetWeb · About · Privacy · Terms