Crypto/Stock FIFO Gains Calculator
Figuring out capital gains on crypto or stock trades gets genuinely annoying once you’ve bought the same asset multiple times at different prices — which lot did you actually sell from, and at what cost basis? The Crypto/Stock FIFO Gains Calculator applies first-in-first-out accounting to your buy and sell history and returns realized gains or losses per sale, matched against the correct original lots.
Trade history is one of the more sensitive financial records you can hand to a third party — it’s not just an amount, it’s a timestamped map of your entire portfolio activity, including exactly how much you hold and when you moved in or out of a position. That’s exactly the kind of data set a server-side tool has no business logging, and exactly why this one runs the FIFO matching entirely client-side. Your transaction history never leaves the browser tab to produce an answer.
You’ll need your buy and sell transactions with dates, quantities, and prices — most exchanges and brokerages let you export this as a CSV. Paste or upload the transaction list, and the tool sorts by date, matches each sale against the oldest remaining lot(s) automatically, and outputs a per-sale gain/loss along with a running total. If a sale spans multiple lots (say you bought in three separate purchases and sold enough to draw from two of them), it splits the calculation across both lots correctly rather than averaging.
If your exported transaction file comes out with broken columns or inconsistent formatting — common with some exchange exports — running it through the CSV Cleaner first will save you from re-entering everything by hand. And if any of your trades were in a foreign exchange or a different quote currency, the Multi-Currency Invoice Reconciler’s conversion approach is useful for getting everything into one currency before you calculate gains.
FAQ
Why does FIFO matter instead of just averaging my cost basis?
Many tax jurisdictions require FIFO (or let you choose it) specifically because it changes the realized gain — selling your oldest, often cheapest, lots first tends to produce a different (often larger) taxable gain than average-cost methods.
Does this account for transaction fees?
Yes, if you include fee data in your import — fees on both the buy and sell side adjust the effective cost basis and proceeds.
Is this a substitute for tax software?
No — this gives you the gain/loss math to work from, but tax treatment of crypto and securities varies by jurisdiction and situation, so treat the output as a calculation tool, not tax advice.
Can I mix crypto and stock transactions in the same calculation?
You can, but it’s cleaner to run them separately since they’re often taxed under different rules depending on where you live.