APIs used:
  • Get token balances for address  
  • Get cross-chain activity for address  
  • Get paginated transactions for address (v3)  
  • Get ERC20 token transfers for address  


Many say there are only two certainties in life: death and taxes. As a crypto enthusiast, I'd add a third one: the complexity of calculating crypto taxes.

In a perfect world, we'd all have accountants adept at navigating the crypto tax realm. They'd be up-to-date on all regulations, cover potential mistakes, and even bear liability for their calculations. Unfortunately, in reality, such accountants are rare, and their services are costly.

Fortunately, Covalent has created a customizable tool that is designed to track all your ERC20 token and native token transfers, calculate adjusted cost basis (ACB), and compute your capital gains. The best part is it's free and open-source, so you can modify and use it for years to come!

Explore the Crypto Cost Basis and Capital Gains Calculator here

How to Use the Cost Basis and Capital Gains Calculator


Once in the spreadsheet, go to File -> Make a copy. Make sure the Attached Apps Script file is included.


Enter a Bitcoin or Ethereum wallet address (domain names supported).


Press the 'Analyze my wallet' button.


Check the prompts and wait for the script to complete.


The 'Activity' sheet shows you every supported chain the wallet has been active on.


The 'Balances' sheet provides a breakdown of every ERC20 and native token balance across every active chain.


The 'Transfers' sheets provide a detailed breakdown of every token transfer in or out of the wallet across all active chains.


The corresponding 'Transfers Balance Sheet' provides a summary of token flows IN and OUT of the wallet and a check against the balance recorded on-chain.

Why We Built This Calculator

Both individual cryptocurrency users and digital asset accounting businesses face significant challenges with the tax intricacies of DeFi transactions. From collecting data and tracking cost basis to navigating inconsistencies across various platforms and networks, the complexities are manifold. Recognizing these challenges, Covalent embarked on a mission to demystify tax compliance. Our cost basis and capital gains calculator, powered by our robust Unified API, taps into data from over 150 blockchains. This data-driven approach offers users a comprehensive view of their transactions and assets. With our rich database capturing historical data and intricate details of activities like DeFi and NFT transactions, we aim to set the gold standard in accurate tax reporting.

Notable Features

  1. Balance Sheet Precision: A paramount feature we offer is the balance check. Often, discrepancies arise between calculated and actual balances. With our tool, you might find the accuracy surprising – it's spot on, down to one-thousandth of a percent!

  2. Filtering by Token: Our calculator allows you to filter results token by token. This unique feature enables you to discern the current cost basis for each individual token so you can understand each asset's performance.

  3. An Informative Summary: At the top right of the input sheet, you will find a summary detailing the Portfolio Value of the wallet address provided, as well as the API credits consumed and total cost of the analysis -which is shockingly low. A few cents, in fact.

  4. Bitcoin Address Support: Our tool supports these calculations for wallets on the Bitcoin blockchain! Simply input a Bitcoin wallet address.

  5. Cross-Chain Address Activity: Another aspect setting us apart is the starting point of the activity sheet – powered by a unique endpoint currently unmatched in the market .

  6. Adjusted Cost Base (ACB): The spreadsheet utilizes the "adjusted cost base" (ACB) method, which is used in Canada for calculating capital gains and losses for tax purposes.

  7. Important Considerations and Future Features:

    1. Internal Transactions: Currently, internal transactions aren't handled in-house. However, rest assured, we're actively developing support for this feature. For now, we’re using the Etherscan API.

    2. Historical Prices vs. Spot Prices: Our tool utilizes historical daily prices (the closing price of the asset) instead of spot prices (updated every 5 minutes). This might introduce slight discrepancies but is adequate for the taxation use case.

A Word on the Adjusted Cost Base Method

The ACB calculates the average cost of an asset, taking into account all purchases and sales. When you buy more of the asset, its cost gets added to the existing average. When selling, the average cost is multiplied by the number of units sold to figure out the sale's cost basis.

Alternate Cost Basis Calculation Methods

Several methods exist for cost basis calculations, influencing your reported taxable gain or loss upon asset sale. Ranging from the commonly adopted First-In, First-Out (FIFO) method in the US to the meticulous Specific Identification approach, our open-source tool allows you to copy and modify the script to suit the calculation method of your needs.


With the ever-evolving landscape of cryptocurrency, having a reliable tool like this, which can save you a hefty accountant fee, becomes indispensable. We invite you to explore the awesome features of our tool and discover its precision and efficiency for yourself. And if you're intrigued by the possibilities of blockchain data, sign up for an API key and unlock the full potential of the Covalent API. Let's make crypto tax season something to actually look forward to!