Crypto Cost Basis Tracker
Track your crypto trades and calculate FIFO, LIFO, or HIFO cost basis. Import via CSV, view realized and unrealized gains, and export an encrypted backup — nothing leaves your browser.
Accounting Method
Add Trade
CSV format & column names
The importer auto-detects the following column names (case-insensitive):
- Date: date, timestamp, time, datetime
- Type: type, side, action, transaction type — values: buy / sell / purchase / sale / in / out
- Quantity: quantity, qty, amount, size
- Price: price, price per unit, unit price, rate
- Fee: fee, fees, commission (optional)
Coinbase, Kraken, and Binance exports are generally compatible after selecting the relevant columns.
Informational only — not tax or investment advice. This tool provides estimates for educational purposes. Tax rules for cryptocurrency vary by jurisdiction and may differ from the calculations shown. Consult a qualified tax professional before filing. Nothing on this page is legal, financial, or tax advice.
How It Works
Add your trades
Enter each buy and sell manually or import your trade history as a CSV file. Supported: date, type, quantity, price, and fee columns.
Choose your accounting method
Toggle between FIFO, LIFO, and HIFO. The calculator instantly recomputes all gains — switch methods to compare tax outcomes.
Review realized & unrealized gains
See total realized gain/loss split by short-term and long-term. Enter the current price to also see your unrealized gain on remaining holdings.
Export an encrypted backup
Save your trade history as a passphrase-protected .allyx file. AES-256-GCM encrypted in your browser — never uploaded anywhere.
How to Use the Crypto Cost Basis Tracker
- Add trades using the Add Trade form — enter the date, type (buy or sell), quantity, price per unit, and any fees.
- Or click Import CSV to load a trade history file from your exchange. The importer auto-detects common column names.
- Select your accounting method (FIFO, LIFO, or HIFO) using the toggle at the top.
- The results panel updates instantly. Enter the current price to see your unrealized gain on remaining holdings.
- Use Export Encrypted to save your trade data as a passphrase-protected
.allyxfile for future sessions.
Understanding the Results
| Result | What it means |
|---|---|
| Realized Gain / Loss | The total profit or loss from all completed sells — proceeds minus cost basis across all matched lots. |
| Short-term Gain | Gain from coins held 365 days or fewer before selling — taxed as ordinary income in the US. |
| Long-term Gain | Gain from coins held more than 365 days — eligible for preferential tax rates of 0%, 15%, or 20% in the US. |
| Total Proceeds | Sum of all sell proceeds (sale price × quantity minus fees) across all sell trades. |
| Total Cost Basis | Total acquisition cost (purchase price × quantity plus fees) of all lots matched to sells. |
| Unrealized Gain | Estimated gain on your remaining holdings if sold at the current price you entered. |
| Effective Gain % | Total realized gain as a percentage of total cost basis — your overall return on sold positions. |
What Is Crypto Cost Basis?
Cost basis is the original value of a cryptocurrency at the time of acquisition, including any fees paid. When you sell, your taxable gain or loss equals the proceeds minus the cost basis of the specific coins you sold. Accurate cost basis tracking is essential for correct tax reporting and is required by the IRS in the United States.
For example, if you bought 1 BTC for $30,000 (including a $15 fee), your cost basis is $30,015. If you later sell it for $45,000 and pay a $20 fee, your proceeds are $44,980 and your capital gain is $44,980 − $30,015 = $14,965.
FIFO vs LIFO vs HIFO — Which Method Should You Use?
| Method | Which lots are sold first | Typical effect | IRS status |
|---|---|---|---|
| FIFO (First In, First Out) | Oldest lots purchased | More long-term gains; lower rates if price rose over time | IRS default method |
| LIFO (Last In, First Out) | Most recently purchased lots | More short-term gains; may reduce gains in falling markets | Allowed with specific identification |
| HIFO (Highest In, First Out) | Highest cost-per-unit lots | Minimises realised gains; maximises tax efficiency | Allowed with specific identification |
In the US, FIFO is the default if you do not specifically identify lots at the time of sale. LIFO and HIFO are permitted under the specific identification rules, but you must identify the lots being sold at the time of the transaction — not retroactively. Always confirm the rules with a qualified tax professional.
Short-Term vs Long-Term Capital Gains on Crypto
The IRS classifies cryptocurrency gains as either short-term or long-term based on your holding period:
- Short-term: Held 365 days or fewer — taxed as ordinary income (10%–37% in 2026).
- Long-term: Held more than 365 days — taxed at preferential rates of 0%, 15%, or 20% depending on your income and filing status.
This calculator classifies each realised gain based on the holding period of the specific lot consumed, as determined by your chosen accounting method.
Encrypted Export: How Your Data Is Protected
The Export Encrypted feature uses the Web Crypto API built into your browser to protect your trade history:
- Key derivation: PBKDF2 with 600,000 SHA-256 iterations and a random 16-byte salt.
- Encryption: AES-256-GCM with a random 12-byte initialisation vector.
- Output: a
.allyxJSON file containing the base64-encoded salt, IV, and ciphertext. - Your passphrase never leaves your device. The file is saved directly from browser memory.
To restore your trades, use the Import .allyx button, enter the same passphrase, and select the file. Decryption also happens entirely in your browser.
Features
- Three accounting methods: Switch between FIFO, LIFO, and HIFO in a single click to compare outcomes.
- Short vs long-term split: Every realised gain is automatically classified based on holding period.
- CSV import: Upload trade history from your exchange. Common column names are auto-detected.
- Unrealized gain: Enter the current price to see estimated gain on remaining holdings.
- Remaining lots view: Inspect which lots you still hold, their acquisition dates, and cost per unit.
- Encrypted backup: AES-256-GCM export with PBKDF2 key derivation — zero-knowledge, zero-upload.
- No account required: Open the page and start tracking immediately.
- Fully private: All calculations run in your browser. Nothing is transmitted to any server.
Frequently Asked Questions
Is my crypto trade data stored or shared?
No. All calculations happen locally in your browser using JavaScript. The trade data you enter is never sent to or stored on any server. Use the encrypted export to save your data between sessions.
What is the difference between FIFO, LIFO, and HIFO for crypto?
FIFO (First In, First Out) sells the oldest lots first — often producing more long-term gains. LIFO (Last In, First Out) sells the newest lots first. HIFO (Highest In, First Out) sells the highest-cost lots first, typically minimising realised gains. In the US, FIFO is the IRS default; LIFO and HIFO require specific identification at the time of sale.
What is cost basis for cryptocurrency?
Cost basis is what you originally paid for a cryptocurrency, including acquisition fees. When you sell, your taxable gain or loss is the proceeds minus the cost basis of the coins sold. Accurate tracking is required for correct tax reporting.
How are short-term and long-term gains classified?
Coins held for more than 365 days qualify for long-term capital gains rates (0%, 15%, or 20% in the US for 2026). Coins held 365 days or fewer are short-term and taxed as ordinary income at rates up to 37%. This calculator classifies each gain based on the lot consumed.
What CSV format does the importer accept?
The importer accepts a CSV with columns for date, type (buy/sell), quantity, price, and an optional fee. Column names are matched case-insensitively — common exchange export names like "timestamp", "side", "amount", "unit price", and "commission" are all recognised.
Is this a substitute for professional tax advice?
No. This tool is for informational and educational purposes only. Cryptocurrency tax rules are complex and vary by jurisdiction. Always consult a qualified tax professional before filing. Nothing on this page constitutes tax, legal, or investment advice.
Privacy & Security
.allyx exports are saved directly from browser memory to your device.