How to Calculate Crypto Capital Gains (Step-by-Step, With Examples)
If you’re wondering how to calculate crypto capital gains, the core idea is simple: every time you sell, trade, or spend crypto, you compare what you received (your “proceeds”) to what you paid (your “cost basis”), then subtract any fees. The difference is your capital gain or capital loss. The hard part isn’t the math—it’s the recordkeeping and matching each sale to the right purchase lot. In this guide, I’ll walk you through the process step by step, with clear examples, tables, and the exact reporting flow most investors use.
How to calculate crypto capital gains (the simple formula)
Crypto capital gains calculations follow the same basic logic as stocks because, for US federal taxes, the IRS generally treats digital assets as property (not cash). That framing sits at the center of the IRS’s own digital assets guidance on when transactions become taxable events. (See the IRS page on digital assets here: Digital assets | Internal Revenue Service)
The basic capital gains formula (proceeds − cost basis − fees)
Use this baseline formula for each taxable disposal:
Capital gain (or loss) = Proceeds − Cost basis − Selling fees
- If the result is positive, you have a capital gain
- If the result is negative, you have a capital loss
A quick plain-English version:
- Proceeds = what you got when you disposed of the crypto
- Cost basis = what you paid for that specific crypto (including certain purchase costs)
- Fees = costs tied to acquiring or selling (often reduce gains)
In practice, you repeat this for every taxable transaction across the year, then total them up.
What counts as “proceeds” in crypto?
“Proceeds” means the value you received when you disposed of crypto.
Common examples:
- You sell BTC for USD: proceeds = the USD you receive (net or gross depends on fee treatment—more on that soon)
- You trade ETH for SOL: proceeds = the fair market value of the SOL you received at the time of the trade
- You spend USDC to buy something: proceeds = the value of what you bought (or the value of the USDC used, depending on the transaction details)
The moment you swap one asset for another, you’re effectively “selling” the asset you gave up, then “buying” the asset you received.
What counts as “cost basis” in crypto?
Your cost basis is usually what you paid to acquire the crypto, plus certain acquisition costs (like trading fees added to the purchase).
Cost basis often comes from:
- Buying crypto with fiat (USD, EUR, etc.)
- Receiving crypto as income (your basis generally starts at the amount included as income)
- Getting crypto as a gift or inheritance (special rules can apply—be careful here)
From my experience, cost basis becomes messy when people:
- Use multiple exchanges
- Move coins between wallets without labeling transfers
- Use DeFi apps that generate dozens of small transactions
If you keep clean records from day one, you can save hours later.
How to calculate crypto capital gains for the most common taxable events
When people say “I only sold a little,” I usually ask one follow-up question: “Did you trade anything?” Because many investors don’t realize which actions count as disposals.
The IRS’s virtual currency FAQs are helpful here because they spell out common scenarios and how they get treated at a high level. You can read them directly on the IRS site: Frequently asked questions on virtual currency transactions | Internal Revenue Service
Selling crypto for cash
This is the cleanest case.
Example:
- You bought 0.5 BTC for $15,000 (including fees)
- Later you sold 0.5 BTC for $20,000 (after fees)
Capital gain = $20,000 − $15,000 = $5,000
You’ll also need:
- Date acquired
- Date sold
- Proceeds
- Cost basis
That’s the exact shape of what ends up on Form 8949 later.
Trading crypto for crypto (yes, it’s taxable)
This is where many people get surprised.
If you trade ETH for SOL, you have two tracking steps:
- Disposition of ETH (taxable): compute gain/loss on ETH
- Acquisition of SOL (not taxable by itself): set basis for SOL using the value at time received
The IRS virtual currency FAQs cover this “crypto-to-crypto trade” concept in plain terms, which is why I often point people there early: Frequently asked questions on virtual currency transactions | Internal Revenue Service
Example (simple):
- You bought 2 ETH for $3,000 total
- Later you traded 2 ETH for SOL worth $4,200 at the time of trade
Proceeds (ETH disposed) = $4,200
Cost basis (ETH) = $3,000
Gain = $1,200
Now your SOL position starts with:
- New basis = $4,200 (plus/minus fees depending on how they were charged)
Spending crypto (buying goods or services)
If you spend crypto, you dispose of it. The math works like a sale.
Example:
- You bought 1 ETH for $1,500
- Later you use 1 ETH to buy a laptop worth $2,000 at checkout
Proceeds = $2,000
Basis = $1,500
Gain = $500
This is why people say spending crypto creates “tax friction.” The purchase triggers a gain/loss calculation.
Transferring crypto between your own wallets (usually not taxable)
A transfer between wallets you own is usually not a disposal by itself. No sale. No trade. And no expense.
But here’s the practical problem: exchanges and tax tools sometimes import transfers incorrectly and label them as disposals if the data doesn’t match.
My personal workflow tip after years of seeing messy files:
I always identify and label internal transfers first before I do anything else. If you don’t, you can end up “selling” the same BTC three times on paper.
How to calculate crypto capital gains when you buy in chunks (DCA) and sell later
Dollar-cost averaging (DCA) creates multiple purchase lots. When you sell later, you must decide which lot(s) you sold—because each lot has its own cost basis and holding period.
This is where people lose the thread.
Identify lots and match them to disposals
You generally calculate gains on a per-lot basis:
- Lot A: bought date + price
- Lot B: bought date + price
- Lot C: bought date + price
Then you sell some amount and match the sold amount to one or more lots.
The method you use to match lots (like FIFO or specific identification) can change your gain significantly.
Example table: 3 buys, 1 sell (DCA example)
Let’s say you bought the same coin three times:
| Lot | Date bought | Amount | Price paid | Fees | Total cost basis |
| A | Jan 10 | 1.0 ETH | $1,200 | $10 | $1,210 |
| B | Feb 15 | 1.0 ETH | $1,600 | $10 | $1,610 |
| C | Mar 20 | 1.0 ETH | $1,800 | $10 | $1,810 |
Later you sell 1.5 ETH for $3,300 total and pay $20 selling fees.
Now you need to decide which 1.5 ETH you sold:
- FIFO would take Lot A (1.0 ETH) + 0.5 ETH from Lot B
- Specific ID could choose different lots if your records support it
This “per disposal, per lot” approach also aligns with the information that ultimately appears on Form 8949, where each line tracks acquisition date, sale date, proceeds, and basis. (About Form 8949: About Form 8949, Sales and other Dispositions of Capital Assets | Internal Revenue Service)
How to calculate crypto capital gains using FIFO vs specific identification
The cost basis method is one of the biggest levers you control (within the rules). Two people can do the same trades and report different gains depending on their method.
For a practical overview of cost basis methods in crypto, Coinbase’s educational guide explains the concept in plain language (it’s not official law, but it’s useful for understanding): Understanding crypto taxes | Coinbase
FIFO explained (First-In, First-Out)
FIFO means the first units you bought are the first units you sell.
Pros:
- Simple
- Works well when records are incomplete (because you don’t need to “pick” lots)
Cons:
- Can create bigger gains in a rising market (because older lots often have lower basis)
Specific identification explained (Specific ID)
Specific identification means you choose which exact units (lots) you sold.
Pros:
- Can reduce taxes by selling high-basis lots first (in some situations)
- Gives more control over short-term vs long-term holdings
Cons:
- You need stronger records (date/time, amount, wallet/exchange trail)
- Can get complicated across multiple wallets and DeFi apps
As a real-world note: specific ID sounds great until you try to apply it across five exchanges and three wallets without consistent transaction IDs. If you want to use it, build your recordkeeping system early, not in April.
Example: Same trades, different outcome
Using the DCA table above, assume this sale:
- Sold 1.5 ETH
- Total proceeds: $3,300
- Selling fees: $20
- Net proceeds after selling fee: $3,280 (one common way people model it)
FIFO calculation
- Lot A basis for 1.0 ETH: $1,210
- Half of Lot B basis: $1,610 ÷ 2 = $805
- Total basis = $1,210 + $805 = $2,015
- Gain = $3,280 − $2,015 = $1,265
Specific ID (choose higher basis lots first)
- Sell 1.0 ETH from Lot C: basis $1,810
- Sell 0.5 ETH from Lot B: basis $805
- Total basis = $2,615
- Gain = $3,280 − $2,615 = $665
Same market. Same sale. Different reported gain because you chose different lots.
Important: you can’t just “pick lots” casually after the fact without support. That’s why good records and consistent method usage matter.
How to calculate crypto capital gains for fees, slippage, and on-chain costs
Fees are the quiet difference between a clean return and a confusing one.
Exchange trading fees
Most centralized exchanges charge trading fees either:
- In the asset you sell
- In the asset you buy
- In a third token (like an exchange token)
From a bookkeeping perspective, fees typically:
- Increase your cost basis on purchases, and/or
- Reduce proceeds on sales
The key is consistency and accurate records. Your exchange trade confirmation usually shows:
- Gross proceeds
- Fees
- Net amounts
Gas fees (and when they matter for gains)
Gas fees complicate things because they can show up on:
- Transfers
- Swaps
- Mints
- Claims
The “right” treatment can depend on what the fee relates to and how the transaction is structured. If you want perfect treatment, you often need software plus manual review, especially for DeFi.
My practical rule of thumb (human, not legal advice):
If the gas fee was part of acquiring an asset (like executing a swap to obtain it), I treat it like an acquisition cost in my tracking system. If it was paid to dispose of an asset, I treat it like a selling cost. And if it was just moving assets between my wallets, I track it as its own event so I don’t accidentally create a fake sale.
When in doubt, keep the raw records (TXIDs, timestamps, amounts) so you can justify your approach.
Slippage
Slippage usually shows up as “you expected X tokens, you received Y tokens.” For tax math, the fair market value at the time of the swap and the actual amounts received matter more than your expectation.
What helps:
- Save swap confirmations
- Save pool transaction details
- Make sure your tracker uses the actual on-chain results
How to calculate crypto capital gains for DeFi, staking, airdrops, and NFTs (high-level)
This section gets tricky fast. I’ll keep it high-level and grounded in reliable framing: many “receive crypto” events resemble income at receipt, and later price changes create capital gains/losses when you dispose.
The IRS virtual currency FAQs provide a starting point for understanding how the IRS thinks about common categories of transactions, even if they don’t cover every DeFi edge case: Frequently asked questions on virtual currency transactions | Internal Revenue Service
Staking rewards and “earn” rewards: income first, then gains
A clean mental model many investors use:
- When you receive staking rewards, you may have income measured at fair market value at the time you receive control of the reward.
- Later, when you sell those rewarded coins, you may have a capital gain or loss based on:
- Proceeds from sale
- Minus basis (often the amount previously recognized as income)
This two-step approach prevents double counting and keeps the timeline logical.
Airdrops and forks: track the moment you can control the asset
Airdrops can feel like “free money,” but for taxes they can create recordkeeping obligations. The key practical task is tracking:
- Date/time received
- Fair market value at receipt (if applicable)
- Later disposal date/time and value
If you don’t track the receipt value, you can end up with a missing basis later, which inflates gains.
NFTs: similar math, messier inputs
NFTs typically follow the same gain/loss formula:
- Proceeds on sale
- Minus basis (mint cost + fees, or purchase price + fees)
The mess comes from:
- Mint costs and multiple fee layers
- Royalties
- Bundled transactions
My personal advice here: keep a dedicated NFT record log with links to marketplaces and TXIDs. NFT activity turns into a blur six months later unless you write it down.
Liquidity pools, lending, wrapping tokens: why it gets tricky
DeFi can include actions that look like:
- Swaps
- Deposits/withdrawals
- Receipt tokens (LP tokens)
- Wrapping/unwrapping (like converting between representations)
Depending on the details, some actions may be treated like dispositions. Some may be closer to deposits. Tax guidance may not describe every protocol behavior cleanly, so you need accurate transaction records and a consistent accounting approach.
This is the part where I’ve seen the most “I swear I didn’t sell anything” moments—because the wallet did something that functioned like a swap under the hood.
How to calculate short-term vs long-term crypto capital gains (holding periods)
Holding period decides whether a gain is typically short-term or long-term (in the US framework). You track:
- Date acquired
- Date sold/disposed
Holding period basics
In plain terms:
- If you held the asset for a shorter period, it may count as short-term.
- If you held it longer, it may count as long-term.
You don’t need to memorize the details to calculate gains, but you do need accurate dates because Form 8949 and Schedule D separate transactions by holding period.
Why it changes your tax result (conceptually)
Short-term gains often get taxed more like ordinary income, while long-term gains often get preferential rates (rules vary by taxpayer situation). That’s why lot selection (FIFO vs specific ID) can matter beyond just basis—it can change the holding period profile too.
How to report crypto capital gains (Form 8949 + Schedule D) and what to save
Once you’ve calculated gains per transaction, reporting becomes a structured paperwork process.
What goes on Form 8949 (crypto disposals)
Form 8949 is where you list each taxable disposal line-by-line (or attach a statement with equivalent detail, depending on your filing method).
The IRS “About Form 8949” page is here: About Form 8949, Sales and other Dispositions of Capital Assets | Internal Revenue Service
You typically need:
- Description (e.g., 0.25 BTC)
- Date acquired
- Date sold/disposed
- Proceeds
- Cost or other basis
- Adjustments (if any)
- Gain/loss
How totals flow to Schedule D
Schedule D summarizes total capital gains and losses and flows into the rest of the tax return.
IRS “About Schedule D (Form 1040)” is here: About Schedule D (Form 1040), Capital Gains and Losses | Internal Revenue Service
In real life, many people:
- Export a Form 8949-style report from a crypto tax tool
- Import totals into Schedule D
- Keep the detailed transaction report with their records
Records checklist (what to save)
If you want to calculate gains cleanly and defend your numbers later, keep:
- Exchange trade confirmations (CSV + PDF if possible)
- Deposit/withdrawal history
- Wallet addresses you control (label them)
- TXIDs for major transfers
- Notes for unusual events (chain splits, hacks, token migrations)
- Screenshots for weird DeFi actions (it sounds silly—until it saves you)
I’m a big believer in “future you” as a stakeholder. In the future you will not remember what “0xabc123” was.

Common mistakes when calculating crypto capital gains (and how to avoid them)
These are the mistakes I see repeatedly, especially with active traders.
Missing cost basis (and accidentally overpaying)
If you can’t substantiate the basis, your reported gain can look bigger than reality.
How to avoid it:
- Import all exchanges you used (even small ones)
- Add wallets early
- Reconcile “unknown deposits” before you finalize
Double-counting transfers as sales
A withdrawal from Exchange A and a deposit into Wallet B is not automatically a disposal. But trackers can misread it when timestamps or amounts don’t align.
How to avoid it:
- Match transfers by amount + date/time window
- Label internal wallets
- Merge duplicates
Not tracking fees
Fees can be small per trade but huge over the year.
How to avoid it:
- Use exchange CSV fields for fees
- Confirm whether fees were netted from proceeds or paid separately
Mixing personal investing with business-like activity
Most readers here invest personally. But if your activity looks like you’re running an exchange service or you operate for others, you can drift into a different compliance zone.
FinCEN’s guidance on when someone is “administering” or “exchanging” virtual currency as a business helps clarify that boundary from a financial crimes compliance perspective (not capital gains math, but still relevant context): Application of FinCEN’s Regulations to Persons Administering, Exchanging, or Using Virtual Currencies
If you think you’re anywhere near “I do this for other people,” talk to a qualified professional.
Crypto capital gains calculator workflow (manual, spreadsheet, or software)
You can do this three ways:
- Manual (fine for a few trades)
- Spreadsheet (fine for moderate activity if you’re organized)
- Software (often necessary for heavy trading/DeFi)
Manual method steps (small number of transactions)
- List every taxable disposal (sell, trade, spend)
- For each disposal, find the acquisition lot
- Compute proceeds and basis
- Subtract fees
- Separate short-term vs long-term (by dates)
- Total gains/losses
If you have fewer than ~20 disposals, this is doable if your records are clean.
Spreadsheet template fields (what to track)
A solid spreadsheet includes:
- Transaction type (buy/sell/trade/spend/transfer)
- Asset sold
- Amount sold
- Date/time sold
- Proceeds (USD value)
- Fees (USD value)
- Asset acquired (if trade)
- Amount acquired
- Date/time acquired
- Cost basis (USD)
- Lot ID
- Exchange/wallet source
- TXID link/notes
If you set that up once, you can reuse it every year.
When software helps (and what to verify)
Software helps most when you have:
- Multiple exchanges
- On-chain wallets
- DeFi activity
- Large transaction counts
But don’t treat software as magic. You still need to verify:
- Transfers labeled correctly
- Cost basis method set correctly
- Missing prices handled reasonably
- Duplicates removed
I’ve seen “perfect looking” reports that were wrong because a wallet got imported twice. The numbers looked professional—and totally incorrect.
How to calculate crypto capital gains: step-by-step example (start to finish)
Let’s do a full example that mirrors real life without getting lost in edge cases.
Scenario
You:
- Buy BTC twice (DCA)
- Trade some BTC into ETH
- Sell some ETH for USD
Step 1: Record your buys (basis lots)
| Lot | Action | Date | Asset | Amount | USD value | Fees | Basis created |
| 1 | Buy | Jan 5 | BTC | 0.1 | $4,000 | $20 | $4,020 |
| 2 | Buy | Feb 10 | BTC | 0.1 | $4,500 | $20 | $4,520 |
You now own 0.20 BTC with two distinct lots.
Step 2: Trade BTC for ETH (taxable disposal of BTC)
On Mar 1, you trade 0.12 BTC for ETH worth $6,600 at that moment. Fees are $30.
You must calculate gain on the BTC you disposed of.
If FIFO:
- Sell Lot 1: 0.10 BTC basis = $4,020 (full lot)
- Sell part of Lot 2: 0.02 BTC basis = $4,520 × (0.02/0.10) = $904
- Total basis disposed = $4,020 + $904 = $4,924
Proceeds (value of ETH received) = $6,600
If you treat the $30 as selling cost, net proceeds = $6,570
Gain = $6,570 − $4,924 = $1,646
Now you also create an ETH lot:
- ETH basis starts around $6,600 (and you’ll adjust for fees consistently based on how you treated them)
Step 3: Sell ETH for USD (taxable disposal of ETH)
On Apr 20, you sell the ETH you got for $7,100, with a $25 fee.
Gain on ETH = (Proceeds − fee) − ETH basis
= ($7,100 − $25) − $6,600
= $7,075 − $6,600
= $475
Now you have two taxable events:
- BTC disposal gain: $1,646
- ETH disposal gain: $475
Total gains (ignoring other trades) = $2,121
That’s the core workflow in action.
Additional points that strengthen your crypto tax calculations
These aren’t “extra fluff.” They’re the exact areas that usually break a gains calculation.
1) Price sources and timestamp consistency
If your exchange gives you USD values at trade time, use those consistently. If you rely on external price data, lock a consistent source and timezone approach.
2) Handling “unknown deposits”
Unknown deposits usually come from:
- Wallet transfers not connected
- Exchange-to-exchange moves
- On-chain receipts not categorized
Treat unknowns like smoke in a house: find the source before you file.
3) Year-end checklist (quick)
- Export all exchange CSVs
- Import wallets
- Reconcile transfers
- Confirm cost basis method
- Review big gains/losses for obvious errors
- Save the final reports and raw exports in a “Taxes/YYYY” folder
FAQs: How to calculate crypto capital gains (quick answers)
How do I calculate crypto capital gains if I used multiple exchanges?
Combine all transaction histories into one ledger (software or spreadsheet), then reconcile transfers so they don’t show up as sales. Your basis carries with the asset.
How do I calculate crypto capital gains on a crypto-to-crypto trade?
Treat it like selling the coin you gave up at the fair market value of what you received, then set the basis of the coin you received to that same value (plus/minus fees consistently). The IRS virtual currency FAQs are a good starting reference: https://www.irs.gov/individuals/international-taxpayers/frequently-asked-questions-on-virtual-currency-transactions
What if I don’t know my cost basis?
You need to reconstruct it from exchange records, wallet history, and bank records. Missing basis can cause you to overstate gains.
Do I need Form 8949 for crypto?
If you have capital gains/losses to report, many taxpayers report disposals on Form 8949 and summarize on Schedule D. See IRS Form 8949: https://www.irs.gov/forms-pubs/about-form-8949 and Schedule D: https://www.irs.gov/forms-pubs/about-schedule-d-form-1040
Is moving crypto between my wallets taxable?
Usually no, but you must label transfers correctly so they don’t get treated as disposals in your records.
Final notes (real talk)
Crypto capital gains math is not hard. The hard part is making your transaction history tell the truth. The best thing you can do is build a clean ledger: label your wallets, match transfers, and pick a cost basis method you can actually support with records.
If you tell me:
- your country (US or not),
- the exchanges you used,
- and whether you did DeFi/NFTs,
I can help you build a calculation workflow that fits your situation without turning it into an accounting thesis.


