ForHosting KIT · Developer Utilities

Crypto Cost Basis Calculator

This crypto cost basis calculator combines purchases made at different prices and in different quantities into one weighted average cost per coin.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter each acquisition as a quantity and price per coin, and the calculator returns the total quantity held, total acquisition cost, and average cost basis. It is useful for portfolio tracking, break-even analysis, and checking figures before preparing records. The calculation is deterministic and keeps large purchases appropriately weighted instead of taking a misleading simple average of quoted prices.

Enter each purchase as a separate lot

Create one row for every crypto purchase that belongs in the calculation. Each row needs the quantity of coins acquired and the price paid for one coin. Quantities may be fractional, so a purchase of 0.015 coins is valid, provided the number is greater than zero. Prices must also be positive finite numbers. Use one consistent quote currency across every row: if the first price is in US dollars, all later prices must also be in US dollars. The calculator does not convert currencies or retrieve exchange rates. It treats the numbers exactly as supplied. Do not combine purchases by averaging their prices before entry, because doing so can discard the effect of different quantities. If two transactions happened at the same price, they may still be entered separately for a clear audit trail. The optional decimal setting controls display rounding only; it does not intentionally reduce the precision of the intermediate weighted calculation. Up to 10,000 purchase records can be processed in one request.

Understand the weighted-average calculation

For each purchase, the calculator multiplies quantity by price per coin to obtain that lot's acquisition cost. It then adds all lot costs and all coin quantities separately. Average cost basis is total acquisition cost divided by total quantity. This is a weighted average: a purchase of two coins influences the result twice as much as a purchase of one coin. A simple arithmetic mean of the listed prices would give every row equal influence and can be substantially wrong when lot sizes differ. The returned total cost therefore reconciles directly with the lot inputs, while total quantity shows the denominator used for the final result. Compensated summation is used to reduce ordinary floating-point accumulation error when many small and large values appear together. Results are rounded to the requested number of decimal places, from zero through twelve. The output includes the purchase count as an additional check that every intended row was included in the calculation.

Use the result with the right scope

The average cost basis is a practical portfolio figure, but it is not automatically a tax filing result. This calculator covers acquisitions only and assumes the cost of a lot is quantity multiplied by price. It does not add exchange fees, network fees, rebates, transfers, disposals, mining income, staking rewards, gifts, forks, or currency conversions. If a fee legally forms part of acquisition cost in your situation, incorporate it into an adjusted per-coin price before entering the row, and preserve the original records that explain that adjustment. Tax authorities may require a method such as specific identification, FIFO, LIFO, or another jurisdiction-dependent convention when coins are sold. Those disposal methods can produce different realized gains even when the current weighted average is known. Use this result for planning, portfolio monitoring, reconciliation, or a break-even reference, then consult the rules and records applicable to your location before reporting taxable gains. An automated request through the API costs $0.002.

Track a portfolio entry price

Combine recurring purchases into one weighted average price per coin for a concise portfolio dashboard figure.

Estimate a break-even level

Compare the average acquisition cost with a market price before considering fees, taxes, or disposal rules.

Reconcile exchange records

Check that exported purchase quantities and acquisition costs produce the expected aggregate totals.

What formula does the calculator use?

It divides the sum of quantity multiplied by price for every purchase by the sum of all purchased quantities.

Why not average the purchase prices directly?

A direct average gives a small purchase the same influence as a large one. Weighted averaging reflects the number of coins bought at each price.

Can quantities contain fractions?

Yes. Positive fractional quantities are supported, which is important for assets commonly purchased in small coin fractions.

Does the result include trading or network fees?

No. Enter an adjusted price if you need fees included, and retain records explaining how that adjusted price was calculated.

Is this the same as a taxable cost basis?

Not necessarily. Tax treatment depends on jurisdiction, transaction history, and the permitted disposal method. The calculator only produces an acquisition-weighted average.

What does an API calculation cost?

Each API request costs $0.002. The browser calculation is available without an API request.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/finance/crypto-cost-basis

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/finance/crypto-cost-basis \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"purchases":[{"quantity":0.5,"price":30000},{"quantity":0.25,"price":36000},{"quantity":1.25,"price":28000}]}'
{
  "purchases": [
    {
      "quantity": 0.5,
      "price": 30000
    },
    {
      "quantity": 0.25,
      "price": 36000
    },
    {
      "quantity": 1.25,
      "price": 28000
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "finance.crypto_cost_basis",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →