WorkingFigures

Investing calculators

Crypto gains calculator

List your buys and sells in order and get the realized result the way tax authorities default to reading it: first in, first out. This is the arithmetic layer only; what rate applies to the gain depends on your country and your year.

Your trades, in order

FIFO result

Realized gain$30,000

Sell proceeds
$60,000
Cost basis used
$30,000
Units still held
0.5
Average cost of what remains
$50,000

Estimate

Formula

Each sell consumes the OLDEST remaining lots first; gain = proceeds − cost basis of the consumed lots. Remaining basis = what the unsold lots cost.

Assumptions

One asset per run, trades entered in chronological order, FIFO lot ordering (the default or mandatory method in most countries, Spain and the UK pooling rules differ in detail). Fees can be modeled by adjusting prices. No tax rate is applied: this is the gain figure, not the tax, and it is general information, not tax or investment advice.

FAQ

Why FIFO and not average cost?
Because it is the default most tax agencies assume when you cannot prove otherwise, and mandatory in several. Spain uses FIFO for identical assets; the US defaults to FIFO unless you specifically identify lots; the UK instead pools at average cost with same-day and 30-day rules, so UK readers should treat this as an approximation.
Do I owe tax on the whole realized gain?
The gain is the taxable BASE, not the bill. Each country then applies its own rates, allowances and loss offsets: Spain taxes it in the savings scale at 19-30%, the US distinguishes short from long term. That layer belongs to your tax return, not this tool.
What about swaps between two cryptos?
Most tax systems treat a crypto-to-crypto swap as a sale of the first asset at its market value that day, so it realizes gain even though no euro or dollar appeared. Model it as a sell of one asset here, and a buy in a separate run for the other.

Related guides