FIFO Capital Gains Calculator
Work out the realized gain or loss on a sale using the first-in, first-out (FIFO) method that most tax regimes require. Enter your buys and sells and get the taxable result — no spreadsheet, no signup.
If you sell in several batches or at different prices, compute the realized result here using the FIFO method (shares bought first are sold first). Enter the operations in chronological order; each sell's result is what goes in the «Resultat» column.
| Operation | Shares | Price | Result | |
|---|---|---|---|---|
| — | ||||
| — |
- Remaining shares
- 0.00
- Remaining avg cost
- 0.00
- Total realized result
- 0.00
Worked example
You buy 10 shares at $100, then 10 more at $150, and later sell 15 shares at $200. FIFO matches the sale against your oldest lots first: all 10 shares from the $100 lot and 5 from the $150 lot. Cost basis = (10 × 100) + (5 × 150) = $1,750; proceeds = 15 × 200 = $3,000; realized gain = $1,250. Five shares from the $150 lot remain unsold.
What is FIFO and why does it matter?
FIFO — first-in, first-out — assumes the first shares you bought are the first ones you sell. Because your earliest purchases often have a different cost basis, the method you use directly changes the taxable gain. Many jurisdictions (including Spain's IRPF and numerous others) mandate FIFO for securities, so matching lots correctly is essential to file accurate numbers.
Stocks and crypto
The same logic applies to crypto in most FIFO regimes: each disposal is matched against your oldest units. Track every buy — including small ones and transfers with a cost basis — so partial sales compute correctly. This tool handles partial lots automatically and flags an oversell if you try to sell more units than you hold.
Frequently asked questions
- Is this FIFO calculator suitable for taxes?
- It computes the realized gain using strict FIFO lot matching, which is the basis many tax authorities require. It is an educational tool, not tax advice — confirm the rules for your country.
- Does it work for cryptocurrency?
- Yes. Enter your crypto buys and sells the same way; FIFO matches disposals against your oldest units.
- What happens with a partial sale?
- The sale consumes your oldest lots first and leaves the remainder open. The calculator keeps track of what is left for your next sale.
- Does it handle fees and currencies?
- This quick calculator focuses on FIFO lot matching. For fees, multiple currencies and a full realized-gains report, upload your broker export to TrimmTrack.
Get a full realized-gains report
Upload your broker's Excel export and TrimmTrack computes FIFO capital gains across every position, currency and year for you.