How to Calculate Crypto Profit and Loss (Including Fees)
Crypto profit and loss is proceeds after fees minus cost basis including fees. Learn the formula, hidden fees, partial sales, swaps and the common errors.
Key takeaways
- P&L = (sell price × quantity − sell fees) − (buy price × quantity + buy fees), not sell price minus buy price.
- In the example, $8.30 of fees turned a $360 price gain into $351.70 of profit, and a 24.32% price move into a 23.70% ROI.
- Fees paid in coins shrink your quantity. Track units, and check totals with a simple cash-in vs cash-out test.
- Lot methods (average cost, FIFO, specific ID) move profit between realized and unrealized, but not the total.
- A crypto-to-crypto swap is measured like a sale at market value, even though no cash reaches your bank.
On this page
- What is the crypto profit and loss formula?
- Worked example: one trade, fees on both sides
- What if the trade loses money?
- Buying a dollar amount instead of a quantity
- Where fees hide in a crypto trade
- When fees are paid in coins, track units
- Partial sales: which coins did you sell?
- Crypto-to-crypto swaps: P&L without cash
- Portfolio-level P&L: the whole account at once
- From P&L to ROI, annualized return and break-even
- What to record for every transaction
- Common crypto P&L mistakes
- The bottom line
- Frequently asked questions
- Sources
What is the crypto profit and loss formula?
Profit and loss (P&L) compares what you got out of a position with what you put in. Both sides need fees, which is where most quick calculations go wrong.
- Cost basis = buy price × quantity + buying fees
- Proceeds = sell price × quantity − selling fees
- P&L = proceeds − cost basis
- ROI = P&L ÷ cost basis
Every fee belongs somewhere in these formulas. Buying fees raise your cost basis, and selling fees cut your proceeds. Tax authorities use the same idea: the IRS, for example, defines the basis of virtual currency as the amount you spent to acquire it, including fees, commissions and other acquisition costs.
Worked example: one trade, fees on both sides
Suppose you buy 0.8 ETH at a hypothetical $1,850 on an exchange that charges a 0.25% trading fee, and later sell all 0.8 ETH at a hypothetical $2,300, paying the same 0.25%.
| Line | Calculation | Amount |
|---|---|---|
| Purchase value | 0.8 × $1,850 | $1,480.00 |
| Buying fee | 0.25% × $1,480.00 | $3.70 |
| Cost basis | $1,480.00 + $3.70 | $1,483.70 |
| Sale value | 0.8 × $2,300 | $1,840.00 |
| Selling fee | 0.25% × $1,840.00 | $4.60 |
| Proceeds | $1,840.00 − $4.60 | $1,835.40 |
| P&L | $1,835.40 − $1,483.70 | $351.70 |
The prices alone suggest a $360 gain. Fees of $8.30 bring the real profit down to $351.70. In percentage terms, the price rose 24.32%, but your ROI is 23.70%. The gap looks small here because the fees are low; with a bigger fee stack, as in the losing trade below, it widens quickly.
- Cost basis: 0.8 × $1,850 + $3.70 fee = $1,483.70
- Proceeds: 0.8 × $2,300 − $4.60 fee = $1,835.40
- P&L: $1,835.40 − $1,483.70 = $351.70
- ROI: $351.70 ÷ $1,483.70 = 23.70%
- Break-even sell price: $1,483.70 ÷ 0.798 = $1,859.27
The last step is your break-even price, the sale price at which P&L is exactly zero: cost basis ÷ (quantity × (1 − selling fee)) = $1,483.70 ÷ (0.8 × 0.9975) = $1,859.27. Any sale below that price loses money, including a sale anywhere between $1,850 and $1,859.27. Our guide to the crypto break-even price shows how larger fee stacks push this target higher.
What if the trade loses money?
Fees work against you in both directions: they shrink gains and deepen losses. Suppose you buy 1,200 units of Token Y at a hypothetical $0.95 through an app that charges 1.5% each way, then sell at $0.80.
| Line | Calculation | Amount |
|---|---|---|
| Cost basis | 1,200 × $0.95 + $17.10 fee | $1,157.10 |
| Proceeds | 1,200 × $0.80 − $14.40 fee | $945.60 |
| P&L | $945.60 − $1,157.10 | −$211.50 |
The price fell 15.79%, a $180 drop on paper, but your loss is $211.50, or 18.28% of what you put in. The break-even price moves too: $1,157.10 ÷ (1,200 × 0.985) = $0.9789, which is 3.05% above what you paid.
Buying a dollar amount instead of a quantity
Most people buy “$2,500 of Coin B”, not “19.86 coins”. To find the quantity, take off any flat fee first, then divide by the price grossed up for the percentage fee:
Quantity = (amount − flat fee) ÷ (price × (1 + fee rate))
Suppose you spend $2,500 on Coin B at a hypothetical $125, with a 0.6% fee and a $1.99 flat charge: (2,500 − 1.99) ÷ (125 × 1.006) = 19.8649 Coin B. Your cost basis is the full $2,500, or $125.85 per coin, and the fees total $16.89. From there, the P&L formula works exactly as before.
Where fees hide in a crypto trade
Not every cost arrives as a line labeled “fee”. This table shows where each one belongs.
| Cost | How it shows up | Where it goes in the formula |
|---|---|---|
| Trading fee | A percentage of the trade | Adds to basis on a buy, cuts proceeds on a sale |
| Spread | A fill price worse than the mid-price | Already inside your fill price, so use actual fills |
| Fee taken in coins | You receive fewer coins than you paid for | Lowers quantity; basis is the cash you paid |
| Card or deposit fee | A surcharge on funding a purchase | Adds to the cost of that purchase |
| Withdrawal and network fees | Coins leave your balance when you move them | Lower the quantity you can sell |
| Slippage | A fill below or above the quote | Already inside your fill price |
Two practical rules follow. First, always use the price you actually got, not the price on the chart. Second, never assume the quantity you bought is the quantity you will sell. Our guide to maker, taker and spread fees explains the trading side, and our guide to Ethereum gas fees covers network costs, which Ethereum’s documentation defines as gas units used × (base fee + priority fee).
When fees are paid in coins, track units
Now suppose the same exchange takes its 0.25% buy fee in ETH. You pay $1,480 and receive 0.798 ETH. You then withdraw to your own wallet, paying a 0.0015 ETH withdrawal fee, and later send the coins back to sell, paying 0.0005 ETH in network fees. You arrive with 0.796 ETH.
Selling 0.796 ETH at $2,300 with the 0.25% fee brings in $1,826.22. Your P&L is $1,826.22 − $1,480.00 = $346.22, which is $5.48 less than in the first example. The 0.002 ETH lost to transfers would have been worth $4.59 at the sale, and paying the buy fee in ETH instead of dollars cost another $0.89, because that ETH would have risen in value too.
Tip: When the details get messy, use the cash test. Add every dollar you put in and every dollar you took out. For a closed position, total dollars out − total dollars in must equal your P&L, whatever happened to fees and transfers along the way. Here: $1,826.22 − $1,480.00 = $346.22.
Partial sales: which coins did you sell?
Once you buy in more than one lot, a partial sale raises a question: which units left? Suppose you bought 0.6 ETH at a hypothetical $1,600 and 0.4 ETH at $2,200, paying 0.25% each time. Your two lots cost $962.40 and $882.20, a total of $1,844.60 for 1.0 ETH. You then sell 0.5 ETH at $2,480, paying a $3.10 fee, for proceeds of $1,236.90.
| Method | Basis of the 0.5 ETH sold | Realized P&L | Unrealized P&L on 0.5 ETH kept* | Total |
|---|---|---|---|---|
| Average cost | $922.30 | $314.60 | $317.70 | $632.30 |
| FIFO (oldest first) | $802.00 | $434.90 | $197.40 | $632.30 |
| Specific ID (newest lot first) | $1,042.60 | $194.30 | $438.00 | $632.30 |
*At $2,480, before any fee to sell the rest.
The total is the same in every row. The method only decides how much profit counts as realized today and how much stays on paper, a split explained in our guide to realized vs unrealized gains. Our guide to your average cost basis shows the averaging step by step.
Which method you may use for taxes is a separate question. As of September 2026, in the US, the IRS lets you choose which units you sold if you can specifically identify them and substantiate their basis, and otherwise treats the earliest units as sold first. In the UK, HMRC pools tokens of the same type under its section 104 rules, with separate same-day and 30-day matching rules. Rules vary by country; check with a qualified professional.
Crypto-to-crypto swaps: P&L without cash
A swap is a sale and a purchase in one step. Suppose you later swap the remaining 0.5 ETH, with its $922.30 average-cost basis, for Token X when ETH is at a hypothetical $2,000. For P&L purposes, you sold 0.5 ETH for $1,000 and realized $1,000 − $922.30 = $77.70 before swap and network fees. For tracking, Token X starts with a cost basis equal to the $1,000 of value you gave up.
This matters because many investors only count P&L when they cash out to dollars. The IRS, for example, says that exchanging virtual currency for other property, including another virtual currency, produces a capital gain or loss. If you swap often, keep a record of the dollar value at the moment of every swap.
Portfolio-level P&L: the whole account at once
The cash test scales up to an entire account. Your total P&L is the current value, plus everything you have withdrawn, minus everything you have deposited:
Account P&L = current value + withdrawals − deposits
Suppose you deposited $5,000 and later $3,000, withdrew $1,200 along the way, and the account is now worth $8,450. Your P&L is $8,450 + $1,200 − $8,000 = $1,650. That figure is exact, but a simple percentage such as $1,650 ÷ $8,000 = 20.6% ignores when each deposit arrived, which is why timing-aware return measures exist.
From P&L to ROI, annualized return and break-even
P&L in dollars is the starting point for every other performance number:
- ROI puts P&L in proportion to what you invested: $351.70 ÷ $1,483.70 = 23.70%. Our guide to the crypto ROI formula covers variations such as including transfer costs.
- Annualized return adds time. A 23.70% ROI earned in three months and the same ROI earned over three years are very different results; our guide to CAGR for crypto shows how to compare them.
- Asymmetry matters when results swing. A 23.70% gain followed by a 23.70% loss leaves you 5.62% down, not flat, as our guide to percentage gains vs losses explains.
- Regular buying needs a different lens. If you invest on a schedule, see our dollar-cost averaging guide, and our guide to time-weighted vs money-weighted returns for measuring results when money moves in and out.
What to record for every transaction
Accurate P&L depends on records made at the time, because exchange histories can be hard to reconstruct later. For each transaction, note:
- Date and time, with the time zone
- Asset and quantity received or sent, after any fee taken in coins
- Price per unit in your reporting currency
- Every fee, and the currency it was paid in
- Platform or wallet, plus the transaction ID for on-chain moves
- For swaps, the market value of both sides at that moment
- For transfers between your own wallets, a note linking the withdrawal to the deposit
Common crypto P&L mistakes
- Using the price change as your profit. A 24.32% price rise was a 23.70% ROI after fees.
- Forgetting fees taken in coins. Every coin paid as a fee is a coin you cannot sell later.
- Ignoring transfer costs. Withdrawal and network fees reduce quantity even when no trade happens.
- Mixing lot methods. Switching between FIFO and average cost across tools or years scrambles your realized figures.
- Treating swaps as non-events. A swap can realize profit or loss at the moment it happens.
- Counting paper gains without exit costs. If you still held the original 0.8 ETH at $2,100, the paper gain would be $196.30, but only $192.10 after the $4.20 fee to sell.
- Losing track of transfers. When you move coins between your own wallets, carry their original basis with them; without linked records, a later sale can look like pure profit.
To run your own numbers, our profit and loss calculator handles percentage and flat fees on both sides and shows your break-even sell price. Staking rewards follow their own math; our guide to APR vs APY covers how reward rates compound.
The bottom line
Crypto profit and loss is proceeds after selling fees minus cost basis including buying fees, and every other return figure builds on that number. Track quantities as carefully as prices, because fees paid in coins and transfer costs shrink what you can sell. When the details get complicated, the cash test still works: dollars out minus dollars in is your result.
Frequently asked questions
How do I calculate profit on crypto?
Subtract your cost basis from your proceeds. Cost basis is the buy price times the quantity, plus buying fees. Proceeds are the sell price times the quantity, minus selling fees. Buying 0.8 ETH at a hypothetical $1,850 and selling at $2,300, with 0.25% fees each way, gives $1,835.40 − $1,483.70 = $351.70 of profit, not the $360 the prices alone suggest.
Do fees count in crypto profit and loss?
Yes. Buying fees raise your cost basis and selling fees reduce your proceeds, so both lower your profit. The IRS, for example, defines the basis of virtual currency as the amount spent to acquire it, including fees, commissions and other acquisition costs. Fees taken in coins also count, because they reduce the quantity you can later sell.
How do I calculate crypto profit if I bought at different prices?
You need a rule for which units you sold. Average cost divides total cost, fees included, by total units. FIFO treats the oldest units as sold first. Specific identification lets you name the units, where allowed. Each method changes how much profit counts as realized now, but the combined realized and unrealized total stays the same. Tax rules on which method applies vary by country.
Is swapping one crypto for another a taxable profit?
In many countries it can be. In the US, the IRS says exchanging virtual currency for other property, including another virtual currency, results in a capital gain or loss. For tracking, treat a swap as a sale of the coin you gave up at its market value, plus a purchase of the new coin at the same value. Check local rules with a qualified professional.
What is the difference between P&L and ROI?
P&L is your result in money, such as a $351.70 profit. ROI expresses that result as a percentage of what you put in: $351.70 ÷ $1,483.70 = 23.70%. P&L tells you how much you made or lost; ROI lets you compare trades of different sizes. Neither accounts for time, which is what an annualized return such as CAGR adds.
Sources
- Frequently Asked Questions on Virtual Currency Transactions — Internal Revenue Service (IRS)
- CRYPTO22200 — Cryptoassets for individuals: Capital Gains Tax: pooling — HM Revenue & Customs (HMRC)
- Gas and Fees — ethereum.org
This content is for education only and is not financial, investment, tax or legal advice. Crypto assets are volatile and you can lose money. Examples use hypothetical numbers. See our disclaimer and editorial policy.