CRYPTO COST BASIS CALCULATOR · RUNS IN YOUR BROWSER · NOTHING UPLOADED

Which lots did you really sell?

Paste your crypto buys, sales and income as a CSV. The calculator matches every sale to your purchase lots under FIFO, LIFO, HIFO, LOFO or a tax-aware rule, splits each sale into short-term and long-term rows, shows what each method would do to your gain and estimated tax side by side, and exports Form 8949 style rows. Your history stays on your device.

Arithmetic on figures you supply. Not legal, tax, or financial advice. New to this? Read FIFO vs HIFO for crypto, with a worked example. More: tax-loss harvesting, Form 8949 boxes G to L, importing exchange CSVs.

Your transactions

Exchange files are converted to the plain format below and shown in the box, so you can fix or fill in any row before matching. Rows the export gives no USD value for (staking rewards, coin-for-coin swaps on Kraken) are left empty and flagged for you to price.

Type is buy, sell, income (staking, mining, airdrops: basis is the USD value you enter) or transfer (not a sale: ignored unless per-wallet matching is on and the row has a to wallet column, in which case the lots move to that wallet keeping their purchase date and basis; the chosen method decides which lots travel). A coin-for-coin swap is one swap row with to asset and to quantity columns (or two rows: a sale and a buy); it is booked as a sale of what you gave up and a buy of what you got, both at the USD total you give for that day. total is the USD value of the coins before the fee; the fee raises basis on a buy and lowers proceeds on a sale. Use price instead of total if that is what your export has.

Options

Fill in "other income" to add the 3.8% net investment income tax: wages plus any staking or mining income, not counting the results below. It applies only when your income with these results passes $200,000 (single or head of household), $250,000 (joint) or $125,000 (separate). Nothing is estimated while it is blank.

Paste or open your transactions, then click Match my lots.

How it is calculated

Lots: every buy is a lot with a quantity and a basis (USD total plus fee); every income row is a lot whose basis is the USD value you entered. Matching: sales are processed in date order, with same-day buys available to a same-day sale. Each sale consumes lots in the order the method dictates and is split into one row per lot used, with proceeds (USD total minus fee) and basis shared out by quantity. FIFO sorts by acquisition date, LIFO reverses it, HIFO and LOFO sort by cost per coin, and the tax-aware rule sorts by the tax each coin would trigger at the rates you entered, with the holding period of each lot deciding which rate applies. That rule is a greedy choice made one sale at a time: it is not guaranteed to be the best possible plan across every sale. Holding period: long-term only when the sale date is after the first anniversary of acquisition. Rounding: each row's proceeds and basis are rounded to cents and the gain is their difference, so the rows add up the way a form does.

Not modelled: prices (you supply every USD value), exchange or blockchain imports, DeFi, NFTs, hard forks, lost or stolen coins, gifts, wash-sale style rules, state tax and the effect of the loss deduction on your other tax; the 3.8% net investment income tax is estimated only if you enter your other income and is a simplified Form 8960. A sale larger than the lots on record is shown with zero basis and a warning rather than hidden. Unverified: tested on hand-calculated examples and invariant checks, not on a real return.

Common questions

What is crypto cost basis and why does it matter?

Cost basis is what you paid for a coin, including fees. When you sell, swap or spend it, your taxable gain or loss is the proceeds minus the basis of the specific coins you disposed of. If you bought the same coin at several prices, which purchase counts as the one you sold changes the gain, and the choice of method is the lever you control.

What is the difference between FIFO, LIFO and HIFO?

They are rules for deciding which purchase lots a sale uses up. FIFO sells your oldest coins first, LIFO your newest, and HIFO the coins you paid the most for, which usually produces the smallest gain today. LOFO takes the cheapest coins first. This tool runs all of them on your own history and shows the gain and an estimated tax side by side, so you can see what each choice would have done.

Can I choose any method I like?

Not necessarily. In the United States the default for property is first in, first out, and using another method generally depends on being able to identify the specific units you sold at the time of the sale and keeping records that show it. Whether a method is available to you, and how to document it, is a question for a tax professional; this tool computes what each method would produce, it does not decide what you are allowed to file.

Is my transaction history uploaded anywhere?

No. The matching runs in your browser from the CSV you paste or open from your own disk. Nothing is sent to a server, there are no accounts, and it works offline after the page loads. That is the reason to use it for a file that lists everything you have ever bought.

Can I open my Coinbase, Kraken, Binance.US, Crypto.com, Gemini, Bitstamp or Robinhood export directly?

Yes. Open a Coinbase transaction history, a Kraken ledger, a Binance.US, Binance spot trade history, Crypto.com App, Gemini or Bitstamp transaction history, a Cash App account-activity export, a Robinhood account activity report (crypto rows only), a Koinly universal CSV (the export many paid tax tools accept), or a Coinbase Pro / Advanced Trade fills report (or several at once) and the page converts it in your browser into the plain format below, buys and sales paired up, Coinbase Convert rows split into a sale and a buy, and transfers left out. Anything the export gives no dollar value for, such as staking rewards or a Kraken coin-for-coin swap, is left empty and flagged so you can price it from that day's rate; it is never counted as zero. The readers follow the published column layouts and have not been checked against every account type, so skim the converted rows before you rely on them.

What columns does the CSV need?

A header row with date, type, asset, quantity and either a USD total or a price per coin. Fee and wallet are optional. Type is buy, sell, income, swap or transfer. Common exchange headers such as Timestamp, Transaction Type, Quantity Transacted, Subtotal and Fees are recognised. Enter a coin-for-coin swap as one swap row (asset and quantity given up, to asset and to quantity received, total = USD value that day), or as a sale and a buy.

How is the holding period decided?

A gain is long-term when the coins were held for more than one year, meaning the sale date falls after the first anniversary of the acquisition date; a sale on the anniversary itself is still short-term. Each piece of a sale carries the date of the lot it came from, so one sale can produce both short-term and long-term rows.

What does per-wallet matching do?

When it is on, a sale only uses lots recorded in the same wallet or account column, instead of one pool across everything you hold. Some tax rules now expect basis to be tracked wallet by wallet. Turn it on if your records tag each row with where the coins sat, and check the current IRS guidance for how to treat coins you moved between wallets. Add a transfer row with a to wallet column and the lots you move keep their original purchase date and basis in the new wallet, so a later sale there is not shown with zero basis. Network fees paid in coins are not treated as sales.

Does this replace crypto tax software or a tax preparer?

No. It is a private calculator for the matching step on a clean list of rows. It does not connect to exchanges or chains, does not fetch prices, does not understand DeFi, NFTs, forks or lost coins, and ignores wash-sale-style rules, state taxes and the effect of the loss deduction on your other tax; the 3.8% net investment income tax is estimated only if you enter your other income. Use the Form 8949 style CSV as a starting point for your own return or hand it to a preparer.