Calculate Your Crypto Taxes using the Formulae Below OR Simply Use My Automated Software by@robinyo

Calculate Your Crypto Taxes using the Formulae Below OR Simply Use My Automated Software

Robin Singh HackerNoon profile picture

Robin Singh

Robin is the Founder and CEO of, a cryptocurrency tax solution with portfolio tracking.

Cryptocurrency taxes (known formally as capital gains taxes) have to be paid on the profit/loss that you make from crypto trading. In this article we will look at how they are calculated. If you want to learn more about how crypto taxation works in general i.e. the laws and regulations, you may want to check out this crypto tax guide.

A capital gain (profit/loss) occurs when you sell or trade cryptocurrencies and is calculated by subtracting the price you bought the crypto for (cost-basis) from the price you are selling it for. Capital Gain = Selling Price - Cost basis. This seemingly simple formula becomes complicated when you add more transactions as we will see. The amount of tax you pay is a percentage of your total capital gains.

Note: Cost-basis is an accounting term that refers to: purchase price + fees + any other acquisition costs.

The best and easiest way of explaining the process of calculating your capital gains is through an example. So, in this article we are going to assume that, a fictional character, John has made the following crypto transactions and wants to calculate his capital gains and taxes.


The first step in determining John's capital gains is figuring out the cost basis of the sold cryptocurrency.

Calculating the Cost-basis

We know that John bought a total of 0.75 BTC for 600 USD. So, an easy way of calculating the cost-basis for each of the Sell transactions would be to simply divide 600 by the amount being sold.

This is known as Average Cost Basis (ACB).

There are also other ways of calculating the cost-basis known as First In First Out (FIFO), Last In First Out (LIFO) and a special variant known as Specific Identification (Spec ID).

In the US, the IRS allows only FIFO, LIFO and potentially Spec ID to determine the cost-basis. ACB is not allowed in the US but is still widely used in countries like Canada & Sweden.

Let's look at how the cost-basis is calculated using each of these methods.

Capital gains using ACB

Average Cost Basis (ACB) is the simplest of all accounting methods. You simply calculate the average price for your holdings in a coin and use that as the cost-basis. The cost-basis for John's two sell transactions can be calculated like this:

Transaction #3Sell 0.5 BTC. John has 0.75 BTC and bought it for a total of 600 USD. The average cost for 1 BTC is: 600 / 0.75 = 800 USD. So, the cost-basis for 0.5 BTC is: 800 x 0.5 = 400 USD.

Transaction #4Sell 0.25 BTC. At this point John only has 0.25 BTC left and bought it for: 600 (total cost) - 400 (already sold) = 200 USD. However, this sale also had a $10 fee so the actual cost-basis is $210.

Now that we have the cost-basis for all transactions, the capital gains can be easily calculated:

Capital gains for txn #3: 

200 (selling price) - 400 (cost-basis) = -200 USD

Capital gains for txn #4: 

400 - 210 = +190 USD

The final capital gains using ACB are -10 USD which means John made a loss of $10.

Capital gains using FIFO

First In First Out (FIFO) means you have to sell the coin that was bought first, first.

Transaction #3Sell 0.5 BTC. The cost basis can be calculated by taking the full cost of the 0.25 BTC txn (ID #1) and half of the cost of the second 0.50 BTC transaction (ID #2): 

100 + (500/2) = 350 USD

Transaction #4Sell 0.25 BTC. Here the cost-basis calculation is picked up from the previous sell transaction. Since only half of the 0.50 BTC in txn ID #2 was sold, the remaining half will go towards the cost-basis for this one. Note that this transaction also has a 10 USD selling fee, so the cost-basis becomes:

 (500/2) + 10 = 260 USD

Let's calculate the capital gains:

Capital gains for txn #3:

 200 - 350 = -150 USD

Capital gains for txn #4: 

400 - 260 = +140 USD

Here the final taxable gains are 

140 - 150 = -10 USD
. Again, a loss of 10 USD.

Capital gains using LIFO

Last In First Out (LIFO) is the opposite of FIFO - here the most recently bought coins are sold first.

Transaction #3Sell 0.5 BTC. Cost-basis for this transaction is relatively straightforward, since the most recent purchase was for 0.5 BTC (txn #2) at a cost of 500 USD - this becomes the cost-basis.

Transaction #4Sell 0.25 BTC. As txn #2 was fully used as the cost-basis for txn #3, you now move to the crypto that was bought before it, which is the 0.25 BTC bought for 100 USD. The amount of crypto being sold and bought is the same so the cost-basis is simply 100 USD. However, you must add the selling fee of $10 so the final cost-basis becomes 

100 + 10 = 110 USD.

The capital gains are calculated in the same way as FIFO/ACB:

Capital gains for txn #3: 

200 - 500 = -300 USD

Capital gains for txn #4: 

400 - 110 = +290 USD

The final capital gains are thus

-10 USD

Capital gains using Spec ID

Specific Identification allows you to pick the assets that you want to sell instead of simply relying on the date of purchase like with FIFO/LIFO. SpecID is generally used when selling stocks/bonds and is allowed by the IRS (United States) on the proviso that you can 'adequately identify' the lots that you are selling. It is not known if cryptocurrency holders can make use of it - as cryptocurrency is classified as property.

Lets look at a different example that can better demonstrate SpecID:

Alice bought 1 BTC for 1000 USD in January and another 1 BTC in Feb for 5000 USD. She sold 1 BTC in May for 4000 USD. Here are her transactions:


Alice has decided to use SpecID. She is aware that she must be able to identify the BTC that she is selling in order to make use of SpecID. To comply with this requirement, the 1 BTC she bought in January is stored in address 0x11111 and the BTC she bought in Feb is stored in 0x22222. This setup allows her to 'adequately identify' the lots that she is selling.

If she sells 1 BTC from 0x11111, her cost-basis would be +3000 USD (profit). If she sells 1 BTC from 0x22222, her cost-basis would be -1000 USD (loss). With this knowledge Alice is much better equipped to make tax-efficient trades.

However, as already mentioned, there is no guideline on whether SpecID is allowed for cryptocurrencies yet.

Which method should you choose?

As you can see all methods resulted in a loss of -10 USD. However, this is due to the low number of transactions and the fact that all of the bitcoin was sold. Under real trading conditions the results of FIFO, LIFO and ACB can be quite different.

Ultimately the choice of method comes down to what is allowed in your country. If you are US based - you have several options but the most recommended and conservative one is FIFO. In countries where you are allowed to choose between different methods it is important to be consistent. You will need to pick a method and stick to it. It is generally quite difficult to switch a method and doing so usually requires authorization from the tax agencies.

Final words

With cryptocurrency tax reporting, the most crucial thing is to keep track of ALL your transactions and trades. If you are a daredevil you may attempt to do your crypto taxes with excel but be prepared to spend many hours on it - generating accurate crypto tax reports is a very time-consuming and elaborate process. Luckily, there are now crypto tax calculators that can easily do this for you.

DISCLAIMER: I am the co-founder of - a cryptocurrency tax solution that automatically generates your crypto tax reports. The calculations explained above are how we designed Koinly to work.


Signup or Login to Join the Discussion


Related Stories