Understanding Unrealized Profit and Loss

Unrealized profit and loss (PnL) is the potential financial gain or loss on an investment that hasn’t been sold yet. In the context of your crypto assets, it represents the difference between the price you purchased a token at and its current market value. Why is this useful to know? Your unrealized PnL is key to knowing when to sell your assets to maximize your crypto gains or minimize your loss. This guide will show you an easy way to calculate and stay on top of your assets using a spreadsheet template.

Essential Concepts for Calculating Crypto Gains

Calculating unrealized PnL for cryptocurrency—or any investment asset—boils down to understanding the difference between what you paid for the asset (its cost basis) and its current market value. Here’s how you can calculate it:

1. Identify the Cost Basis

The cost basis is the original value of an asset for tax purposes. In the case of cryptocurrencies, this would be the amount you paid to purchase the crypto. If you have purchased the same token multiple times, for instance, you’ve accumulated ETH throughout the year, then your cost basis is usually the average price that you’ve paid for that asset.

2. Determine the Current Market Value

This is the current price at which the asset could be sold in the market. For crypto, prices often fluctuate quite significantly due to market volatility, so it’s important to be on top of this. You can find the current price of your assets on the exchange you wish to sell it on, or a third-party site like https://coinmarketcap.com/ or https://www.coingecko.com/.

3. Calculate Unrealized Profit or Loss

Once you have the cost basis and the current market value, the calculation is straightforward:

Unrealized PnL=Current Market Value−Cost Basis

If the result is positive, you have an unrealized profit. If the result is negative, you have an unrealized loss.

Step-by-Step Guide to Calculating Unrealized Profit and Loss

Let’s take a simple example and walk through it step by step, before moving to our spreadsheet tool where we can automate this process for our entire portfolio.

Single Purchase Example:

Imagine you bought 1 Bitcoin (BTC) for $30,000. This is your cost basis. The current market price of 1 BTC is $60,000.

Unrealized PnL=Current Market Value−Cost Basis

Unrealized PnL=60,000-30,000

Unrealized PnL=30,000

Multiple Purchase Example:

Now let’s say you bought Bitcoin several times throughout the year. The first time, you bought 1 BTC for $30,000. The second time, you bought another 1 BTC for $40,000 (you’re quite rich). The third time, you bought another 1 BTC for $45,000. The current market price of 1 BTC is $60,000.

Now, in this case, our cost basis is not derived from a single value. It is the average price we paid for the units of BTC.

Average Cost Basis=Total Spent on Purchases/Total Quantity of Asset Purchased

💡 It’s important to note that for tax purposes, this is arguably the most common way to calculate your cost basis, but it can differ depending on where you are. It’s best to always follow the tax guidelines in your area from a government source.

In our example, the average cost basis of your BTC would be:

Average Cost Basis=(30,000+40,000+45,000)/(1+1+1)

Average Cost Basis=(115,000)/(3)

Average Cost Basis=(115,000)/(3)

Average Cost Basis=38333.33

Now, we have our average cost basis, so let’s proceed to calculate our unrealized PnL if the market value sits at $60,000.

Recall the standard unrealized PnL formula:

Unrealized PnL=Current Market Value−Cost Basis

Our unrealized PnL if we sold a single BTC would be:

Unrealized PnL=60,000−38333.33

Unrealized PnL=60,000−38333.33

Unrealized PnL=21666.67

But we have to factor in the size of our position, for instance, if we actually wanted to sell all of our BTC and not just one, the calculation would be as follows:

Unrealized PnL=Size of Position*(Current Market Value−Cost Basis)

Unrealized PnL=3*(60,000-38333.33)

Unrealized PnL=65,000.01

How to Calculate Unrealized PnL for ALL Your Crypto Assets

Now that we’ve gone through some examples with a single token, you’re probably thinking this will take you a lot of time to go through your entire portfolio. Fortunately, we built an easy-to-use spreadsheet tool that allows you to plug in your wallet address and get a breakdown of your assets including their cost basis, capital gains, and unrealized PnL!

Find our Crypto Accounting Tool here.

To use this tool, you only need a free Covalent API key, which you can create by following the steps in our Setup guide.

Once you have key:


Log into your Google Account.


Go to File -> Make a copy. Make sure the Attached Apps Script file is included.


Enter your wallet address (Bitcoin, Ethereum or any EVM supported by Covalent). Domain names like ENS are supported.


Enter your API key.


Press the Analyze my wallet button.


Check the prompts and wait for the script to complete.

Examining the Output

Once each script has completed, you can explore a detailed breakdown of your activity, balances and token transfers across multiple blockchains. In the Native Transfers Balance Sheet and Token Transfers Balance Sheet, you can find your unrealized PnL broken down by token, like so:

Using this helpful tool, you can stay on top of unrealized PnL for all your assets!

Implications of Unrealized Profit and Loss

For general portfolio management, tracking unrealized gains or losses helps you make smart moves, like deciding when to sell. However, unrealized PnL can have significant implications when it comes to your taxes. Capital gains or losses (what you pay taxes on) in your crypto don't hit your wallet until you sell. This means you can plan when to sell based on your tax situation—maybe sell when you're in a lower tax bracket or offset gains with losses from another investment.


This guide has walked you through the essentials of calculating unrealized PnL, from identifying your cost basis to leveraging Covalent’s Crypto Accounting Tool for comprehensive portfolio analysis. Whether you’re assessing a single asset or all of your investments, understanding your unrealized gains or losses can help you strategize effectively to get the most out of your crypto investments. If you have any feedback on our tool, we would love to hear it! Email [email protected].