How to Calculate Crypto Gains Step-by-Step

We outline how to calculate your crypto capital gains tax, including tracking crypto transactions, choosing an accounting method, and finding your cost basis.

Zac McClure
ByZac McClure, MBA Expert reviewed byTynisa (Ty) Gaines, EAUpdated on September 30, 2022 · minute read

TokenTax content follows strict guidelines for editorial accuracy and integrity.

Key Takeaways

  • To find your capital gain or loss, subtract your proceeds from your cost basis.

  • To calculate your capital gains and losses, you need to track your tax lots. Using crypto tax software and/or taking detailed records will help you do this.

How to Calculate Crypto Gains Step-by-Step

It’s pretty basic: to pay your tax bill, you’ll need to know the amount of  your cumulative gains or losses. In what follows, we’ll outline how to calculate crypto gains so you’ll know what to report and pay. 

1. Tracking crypto transactions

To calculate your crypto gains for taxes, you need to track your transactions and their associated tax lots. A tax lot is simply the record of tokens purchased or otherwise acquired in a single transaction.

A tax lot includes the following transaction information:

  • Amount and currency of the digital asset sold

  • Fiat value at time of acquisition

  • Date of acquisition

  • Fiat value at time of trade or sale

  • Date of sale

It’s very important to keep detailed records of your trades, as it can be difficult to retroactively find and fill in the missing data that may be inflating your gains. The simplest solution for this challenge is crypto tax software, which automatically tracks your transactions.

Be aware, however: if you are using a crypto tax calculator, it's a good idea to keep notes on special situations, such as lost coins, crypto scams and rug pulls, and ICOs.

2. Finding your cost basis

An important term in cryptocurrency tax is cost basis. It refers to the original value of an asset for tax purposes. 

At its core, calculating crypto capital gains and losses is simple: proceeds - cost basis = capital gain or loss.

However, two variables may affect your cost basis: accounting method and transaction fees. 

Crypto tax accounting methods

The IRS allows taxpayers to choose which variation of specific identification accounting they will use each year.  Specific ID methods match up sales and acquisitions differently; using one method on your trading data can produce different cost bases than using another. 

Among the most popular allowed methods  are FIFO, LIFO, and HIFO.

  • First in, first out (FIFO): Assets acquired first are sold first

  • Last in, first out (LIFO): Assets acquired last are sold first

  • Highest in, first out (HIFO): Highest price assets are sold first

Accounting method variations example

  • You have 3 BTC: 1 BTC was purchased in 2018 for $8,000; 1 was purchased for $50,000 in 2021, and 1 was purchased for $19,000 in 2022.

  • In 2022, you sell 1 BTC for $23,000. 

  • If you choose FIFO, your capital gain will be $15,000 ($23,000-$8,000)

  • If you choose LIFO, your capital gain will be $4,000 ($23,000-$19,000)

  • If you choose HIFO, you will have a capital loss of $27,000 ($23,000-$50,000)

Transaction fees

A lot of crypto transactions involve transaction fees (paid to exchanges or protocols) or Ethereum gas fees. In many cases, these fees can be added to your asset’s cost basis to decrease your capital gains or increase your capital losses.

Cost basis calculation example

  • To swap 3,000 USDC for 1 ETH on Uniswap, you had to pay $100 in fees.

  • You can add that $100 to the ETH’s cost basis, making it $3,100.

Note that whether transaction/gas fees can be added to cost basis depends on the type of transaction. We write about the distinctions in this post about deducting Ethereum gas fees.

3. Determining your crypto capital gains tax rate

Crypto transactions are taxed at different rates depending on the length of time the assets were held. If they were held for a year or less, the transaction is a short-term trade. If assets were held more than a year, the transaction is a long-term trade. 

Long-term gains are treated preferentially by the IRS, with rates of 0%, 15%, or 20% depending on your tax bracket. Short-term gains are taxed at your ordinary income tax rate.

Because short-term and long-term trades are taxed at different rates, so they are reported separately to the IRS. This means you should also split them up when calculating your crypto capital gains. 

4. Calculating your crypto gains

Once you’ve assembled your full transaction history, you can start calculating your capital gains and losses. To illustrate the specific details of the calculation, let’s walk through some concrete examples of how to match up crypto trades.

If you buy cryptocurrency, trade it short-term for another coin, and then sell that coin long-term for fiat currency, your capital gains tax calculation will be split out between short-term and long-term crypto trades held for a duration of less than a year or greater than a year, respectively. An example of such a transaction series is below:

  • You bought 1 BTC for $30,000 (including fees), thus your cost basis for this lot of 1 BTC is $30,000.

  • You sold this 1 BTC for $32,000 (including fees) worth of LTC the next day, thus the proceeds are $32,000.

  • Subtract the cost basis of $30,000 from the proceeds of $32,000, and your gain is $2,000. This amount is subject to short-term capital gains tax and reported on that year's tax returns.

  • More than a year later, you sold the $32,000 of LTC for $35,000 (including fees) in dollars.

  • Subtract the cost basis of $32,000 from the proceeds of $35,000, and your gain is $3,000. This amount is subject to long-term capital gains tax and reported on the tax returns of the year in which it was sold.

Now imagine that instead of $32,000 of LTC being sold at a gain, it was sold at a loss. That tax year, you engaged in other trading that resulted in cumulative long-term gains of $50,000.

  • You sell the $32,000 of LTC for $25,000 (including fees). The proceeds are thus $25,000.

  • Subtract the cost basis of $32,000 from the proceeds of $25,000 for a net loss of $7,000.

  • Subtract your long-term capital loss of $7,000 from your long-term capital gains of $50,000. Your new taxable long-term gains amount is $43,000.

You can simplify this process by using a crypto gains calculator. These work by aggregating your data and then automatically linking your cost bases to your sales, using accounting methods like FIFO or LIFO. hey calculate your gains or losses and generate tax reports with your data.

These are the basic steps of using a crypto tax calculator:

  1. Import all your cryptocurrency exchange trade history, as well as any transactions made off-exchange.

  2. Verify that all historical data has been imported, and that your crypto taxes are calculated properly. If not, manually edit the data to correct it.

  3. Decide on a crypto accounting method.

  4. Export your crypto tax forms.

  5. Include your crypto taxes on your return.

FAQs about calculating crypto gains 

How is a crypto gain or loss "realized"?

Gains on crypto are not “realized” until you sell, exchange, or spend the asset. 

In other words, if you purchased a token and simply held it—never selling or exchanging it—you don’t have any taxable gains or losses. 

Our tax loss harvesting dashboard can help you keep tabs on your unrealized gains and losses are, so that you can strategically harvest your losses to potentially lower your tax liability.

Is like-kind exchange allowed for crypto?

A like-kind exchange is when you exchange one asset for another similar asset without recognizing capital gains or losses on the transaction.[1]

Like-kind is specifically disallowed for crypto.[2] It can only be used for real estate.

For more info on crypto tax basics, visit our Crypto Tax Guide. For more on using TokenTax as your crypto tax software visit our Help Center’s getting started guide.

To stay up to date on the latest, follow TokenTax on Twitter @tokentax.

Related Content


Last reviewed by Tynisa (Ty) Gaines, EA on September 30, 2022 · Sources

Zac McClure
Zac McClureCo-Founder at TokenTax
Zac co-founded TokenTax after his career in international finance and accounting at JPMorgan, Imprint Capital and Bain. He has worked in more than half-dozen countries and received his MBA from the UPenn Wharton School.
Tynisa (Ty) Gaines
Reviewed byTynisa (Ty) GainesProject Manager at TokenTax
Tynisa (Ty) Gaines, EA has more than 20 years of experience as a tax professional. Ty has published numerous tax articles, two tax e-books, and an academic publication on cryptocurrency for the National Income Tax Workbook.

Let’s get started.

Check out our plans and pricing to find out which solution best meets your needs.

Review plans