Koinly Guide

How to Calculate Crypto Capital Gains: A Step-by-Step Guide

Calculating crypto capital gains comes down to a simple formula for each sale or trade: **Capital Gain or Loss = Fair Market Value (FMV) at the time of disposal − Your Adjusted Cost Basis.** You calculate this for every taxable event—selling crypto for fiat, trading one coin for another, or spending it on goods—then sum the results for the year. The complexity lies not in the math but in tracking your cost basis accurately across exchanges, wallets, and multiple purchases of the same asset.

Step 1: Identify Your Taxable Events

Before you can calculate anything, you must know which actions trigger a taxable event. Not every movement of crypto is taxable.

Events That Are Taxable

  • Selling crypto for fiat currency (e.g., BTC to USD or EUR).
  • Trading one cryptocurrency for another (e.g., ETH to SOL). Most jurisdictions treat this as a disposal of the first asset.
  • Spending crypto on goods or services (the FMV of the item is your proceeds).
  • Earning crypto as income (mining, staking rewards, airdrops) — this is taxed as ordinary income first, and then the fair market value becomes your new cost basis for future gains.

Events That Are Not Taxable

  • Transferring crypto between your own wallets — moving coins from an exchange to a hardware wallet is not a disposal.
  • Buying crypto with fiat — this simply creates a cost basis.
  • Holding — no tax until you sell or trade.

Step 2: Determine Your Cost Basis

Your cost basis is the original value of the asset you are disposing of, plus any fees paid to acquire it. This is where most errors happen because you rarely buy all your coins at once.

The Pooling Method vs. Specific Identification

If you bought 1 ETH at $1,000 in January and another 1 ETH at $2,000 in June, and then sell 1 ETH in December for $3,000, which ETH did you sell? Your answer changes the gain. Two common methods exist:

  • FIFO (First-In, First-Out): You sell the oldest coins first. In the example, you'd sell the $1,000 ETH, realizing a $2,000 gain.
  • Specific Identification: You explicitly choose which coins you are selling. If you can identify the $2,000 ETH, your gain is only $1,000. This requires detailed wallet tracking and is not always permitted by tax authorities.

Most tax software, including Koinly, defaults to FIFO but lets you switch to other methods like HIFO (Highest-In, First-Out) if your jurisdiction allows it. Whichever you choose, apply it consistently.

Step 3: Calculate the Proceeds and the Gain

Proceeds are the fair market value of what you received at the exact time of the trade. If you sell BTC for ETH, your proceeds are the USD value of the ETH at that moment, not the value of the BTC when you bought it.

Once you have both numbers, the calculation is straightforward:

Gain = Proceeds − Cost Basis

If the result is positive, you have a capital gain. If negative, a capital loss, which may offset other gains or reduce your taxable income (subject to local rules).

Handling Fees

Exchange trading fees generally increase your cost basis (if buying) or reduce your proceeds (if selling). Network transaction fees (gas) are trickier—they are usually considered part of the cost basis if they were required to acquire the asset, but not if they were just moving between your own wallets.

Step 4: Adjust for Income Events Before Calculating Gains

If you received crypto via staking, mining, or airdrops, you cannot skip the income step. The fair market value of the crypto on the day you received it becomes your cost basis. For example, if you staked and received 0.5 ETH when it was worth $1,500, your cost basis for that 0.5 ETH is $1,500. If you later sell it for $2,000, your capital gain is $500—but you also owe ordinary income tax on the original $1,500.

Step 5: Aggregate and Report—or Use a Crypto Tax Tool

Once you have calculated every individual gain and loss, you must sum them into short-term (held less than a year) and long-term (held more than a year) categories, because they are taxed at different rates in many countries. Then you transfer these totals to your tax return forms (e.g., Schedule D and Form 8949 in the US).

For anyone with more than a handful of transactions, doing this manually is error-prone. Tools like Koinly automatically sync your exchange and wallet data, apply your chosen cost basis method, compute gains for each trade, and generate the necessary tax reports. The core logic remains the same as the manual process—the software just handles the volume and the timing precision.

StepKey QuestionCommon Mistake
1. Identify eventsWas this a disposal?Treating wallet transfers as sales
2. Cost basisWhat did I originally pay?Using average price without legal basis
3. ProceedsWhat was the FMV at sale time?Using the price from a different day
4. Income eventsDid I earn this?Forgetting to set the initial basis
5. AggregateShort-term vs. long-term?Mixing holding periods

Final Practical Tips

Keep a written record of every transaction: date, amount, FMV, and the wallet address. If you use a tax platform, export your raw transaction history as a backup. And remember that tax rules vary significantly by country—what counts as a taxable event in the US may differ in the UK, Australia, or Germany. When in doubt, consult a tax professional who understands crypto, rather than relying on a generic calculator. The formula is simple; the context is not.