Your portfolio shows a 40% gain. Your neighbour, with exactly the same purchases, shows 12%. One of you is computing cost basis wrong, and it is not always the one you would guess.
- Cost basis is a quantity-WEIGHTED average, never the average of the prices you paid.
- Fees are part of cost basis: leaving them out mechanically inflates every performance figure.
- A sale does not change the cost basis of the units you keep, although almost everyone believes it does.
- A crypto-to-crypto swap creates a new cost basis, equal to the market value of what you gave up at that moment.
Cost basis is what one unit of your holdings cost you on average. It is the one figure that turns a value into a result: without it you know what your portfolio is worth, never whether it made you anything. Four rules are enough to get it right, and each one is regularly missed.
The base rule: a weighted average, not an average of prices
This is the most common and most tempting error. You bought three times. You add the three prices, divide by three, and get a number that looks reasonable. It is wrong as soon as the amounts differ, and they almost always do.
| Purchase | Amount spent | Unit price | Quantity received |
|---|---|---|---|
| First | $200 | $20,000 | 0.01 |
| Second | $1,000 | $25,000 | 0.04 |
| Third | $300 | $30,000 | 0.01 |
The average of the three prices gives $25,000. The true cost basis is total spent, $1,500, divided by total received, 0.06 units: $25,000 as well, by coincidence in this balanced example. Change one line, put $3,000 on the second purchase instead of $1,000, and the average of prices stays $25,000 while the true cost basis falls to $25,555. The average of prices ignores that you put ten times more money in at one price than another.
The formula fits in one sentence: everything you paid, divided by everything you received. It never requires knowing each purchase individually, only keeping two running totals. That is also why a free crypto portfolio tracker does not need one row per purchase: it keeps both running totals for you.
Fees are part of cost basis
You spend $1,000, the platform takes 1.5%, and you receive $985 worth of crypto. Your cost basis is not computed on $985, it is computed on the $1,000 that actually left your pocket. That is the sum you need back to break even.
Ignoring fees looks harmless on each trade and is anything but by the end. Across twenty purchases at 1.5%, close to a third of a month of performance vanishes from the calculation. The portfolio reports a gain where there is a loss, and the gap widens the more often you buy in small amounts.
The same logic covers withdrawal fees to a personal wallet, which cut the quantity received without cutting what you paid. A 0.5 ETH withdrawal arriving as 0.497 ETH did not lower your cost: it raised your cost basis.
A sale does not change the cost basis of the rest
This is the counter-intuitive point, and the one that starts the most arguments. You hold 1 unit at a cost basis of $20,000. You sell half at $30,000. What is the cost basis of the rest?
It is still $20,000. Selling does not change what the units you keep cost you. Total cost halves because the quantity halves, and the ratio of the two, which is precisely the cost basis, does not move a cent.
The classic mistake is to subtract the sale proceeds from total cost, which makes cost basis plunge, sometimes into negative territory. You then read reasoning along the lines of having recovered your stake, so the rest costs nothing. That is true in cash terms and false in performance terms: those units did cost you $20,000 apiece, and that is the price against which their return must be measured.
| Event | Effect on quantity | Effect on total cost | Effect on cost basis |
|---|---|---|---|
| Purchase | Up | Up | Recomputed as a weighted average |
| Partial sale | Down | Down proportionally | None |
| Transfer between your own accounts | None | None | None |
| Withdrawal fee | Down | None | Up |
| Swap for another crypto | Creates a new position | New cost | New cost basis on the asset received |
Crypto-to-crypto swaps, the most-missed case
As long as you buy with cash, everything is simple. The day you convert SOL into ETH, the question becomes: what cost basis does the ETH received get?
The answer is the market value of what you gave up, at the moment you gave it up. If your SOL was worth $800 at the swap, your ETH cost you $800, whatever price you paid for that SOL months earlier. Carrying the old cost basis across means dragging along a number that no longer corresponds to anything, making every later performance figure wrong.
A corollary often forgotten: that swap closes your SOL position. Its performance stops there, and it is real even though not a single dollar moved. A portfolio that never closes swapped positions ends up with a history in which nothing was ever won or lost.
Portfolio tracking and tax filing are not the same calculation
This page is about tracking. It explains how to know what your holdings cost you, in order to measure performance and decide. That is private use, and you are free in your method as long as it stays consistent over time.
Tax filing is another trade, with its own calculation rules, its own forms and its own deadlines, which differ by country and change over time. A figure that is right for your tracking is not automatically the one an authority expects. For that part, a specialised tax tool or a professional is the right address, and we are not one.
Keeping it current without losing your Sundays
The four rules above are simple to state and tedious to apply by hand once transactions pile up, especially the weighted average after each purchase and the new cost basis after each swap. That is exactly the work a tool should do for you.
Tradoshi's crypto portfolio tracker keeps cost basis per asset, including when the same coin is spread across several platforms: quantities add up and the cost is that of the whole position, never of one half. It is free on every plan, entry is manual, cold storage included, and no broker statement is required.
If you would rather stay in a spreadsheet, that is a perfectly defensible choice: our article on tracking a crypto portfolio in Excel gives the minimal structure that survives and names the three places where it gives way.
Frequently asked questions
How do I compute crypto cost basis?
Total spent divided by total units received, fees included. It is a quantity-weighted average, never the average of the prices paid, which is wrong as soon as the amounts differ.
Does selling lower my cost basis?
No. Selling cuts quantity and total cost in the same proportion, so their ratio, which is cost basis, does not move. Subtracting sale proceeds from total cost is the most frequent error and can drive cost basis negative.
Should fees be included in cost basis?
Yes. Cost basis rests on what actually left your pocket, fees included. Leaving them out inflates every performance figure, the more so the more often you buy in small amounts.
What is the cost basis after swapping one crypto for another?
The market value of what you gave up at the time of the swap. That swap also closes the position you gave up: its performance stops there, even though no cash moved.
Does this calculation work for my tax return?
No. Portfolio tracking and tax filing share neither rules nor purpose. For filing, go to a specialised tax tool or a professional.