HANNISOL
Sign in
Investor Playbook2 min read·Apr 6, 2026

How to Calculate Realized Profit and Loss in Crypto Trading

Your wallet showing a green number doesn't mean you've made money — until you sell, it's unrealized. Learn how to calculate your actual realized PnL and why cost basis tracking matters for taxes.

H
Hannisol Team
How to Calculate Realized Profit and Loss in Crypto Trading

The difference between paper wealth and realized profit

In crypto trading, there are two types of gains and losses: unrealized and realized. Unrealized gains or losses exist on paper — your tokens are currently worth more or less than you paid for them, but you haven't yet sold. Realized gains and losses are the actual profit or loss you've locked in by completing a transaction — selling the tokens and receiving cash or stablecoins in return.

The distinction matters for two reasons: first, unrealized gains can evaporate before you realize them (a token that shows +300% can go to zero before you sell); second, only realized gains are taxable in most jurisdictions — you don't owe taxes on tokens you hold, only on tokens you sell.


How to calculate cost basis on Solana

Your cost basis for any token position is the total amount you spent to acquire it, including transaction fees. If you made multiple purchases at different prices (which is common with DCA strategies or adding to positions), your cost basis is the average cost across all purchases.

Example: You bought WIF in three tranches:

  • 100 WIF at $1.00 = $100
  • 200 WIF at $0.80 = $160
  • 150 WIF at $1.20 = $180

Total: 450 WIF for $440. Average cost basis: $440 ÷ 450 = $0.978 per WIF.

If you later sell 300 WIF at $1.50, your realized gain is: (300 × $1.50) - (300 × $0.978) = $450 - $293.40 = $156.60 realized profit.


Cost basis accounting methods

When you sell a portion of a position acquired at different prices, tax treatment depends on which specific tokens are considered "sold." Different accounting methods produce different taxable outcomes:

FIFO (First In, First Out): The tokens bought first are considered sold first. If your first purchase was at a low price and the current price is high, FIFO typically produces the highest taxable gain — but also gives you long-term capital gains treatment sooner.

HIFO (Highest In, First Out): The tokens with the highest cost basis are considered sold first, minimizing your realized taxable gain in the current period. This method typically produces the lowest tax bill on each individual sale.

Specific identification: You explicitly identify which specific purchase lots are being sold. Requires detailed records but offers maximum flexibility for tax optimization.


Tracking PnL with Solana-compatible tools

Manual calculation across dozens of Solana transactions is impractical. Tools like Koinly, CoinTracker, or Taxbit integrate with Solana wallet addresses and automatically calculate cost basis, realized gains/losses, and tax reports. Connect your wallet from your first trade for the cleanest records.

Analyze any token's security profile before adding to your tracked positions using Hannisol at Hannisol.

Ready to apply this to a real token?

Run any Solana mint address through Hannisol's 8-dimension risk engine — free, no signup required.

Analyze a token on Hannisol →

Related articles