Calculating crypto taxes manually is error-prone, especially when you’re transacting between centralized exchanges, DeFi pools, and multiple wallets. A crypto tax calculator helps to calculate capital gains and losses accurately, saving you time while lowering the risk of penalties. This free Crypto Tax Calculator Google Sheets template automatically fetches historical crypto prices using the CoinGecko API, calculates your capital gains and losses with the FIFO method, and separates them into Short-Term and Long-Term categories. The template provides a structured way to determine your tax liability from selling, swapping, or spending crypto, all based on accurate, verifiable historical data from the industry's most trusted source.
To get started and follow along with the setup steps, you can make a copy of the free Google Sheets template using the download link at the end of this article.
What is Crypto Tax?
Cryptocurrency is generally treated as property by tax authorities like the IRS, not as currency, which determines how various transactions are taxed.
Tax liability for crypto falls into two main categories:
-
Ordinary Income: If you are paid in cryptocurrency (e.g., salary, staking, mining rewards, or airdrops), the Fair Market Value (FMV) in USD at the time of receipt is taxed as ordinary income. These profits are taxed at your regular income tax rate, which can range from 10% to 37% in the United States of America.
-
Capital Gains/Losses: This tax applies when you dispose of crypto holdings, which includes selling for fiat, swapping crypto-to-crypto, or using it to buy goods or services. The taxable event is calculated by subtracting your Adjusted Cost Basis from the sale proceeds. For example, if you bought 1 ETH for $1,500 and later used that 1 ETH to buy a laptop when its value was $2,000, you've made a $500 capital gain that you need to report for tax purposes.
How Capital Gains and Losses Are Calculated
To calculate your Capital Gain/Loss, you must first determine the Cost Basis of the specific coins disposed of. Your cost basis is simply the original price you paid for an asset, and it is crucial for calculating the profit from any taxable transaction, such as selling or swapping crypto. Your final cost basis includes the original price plus any related transaction fees.
For example:
-
If you bought ETH for $2,000 and paid a $5 gas fee, your cost basis is $2,005.
-
If you later sell this ETH for $3,000, paying a $15 fee, your capital gain is calculated as:
$3,000 - $2,020 = $980 (where $2,020 is the total adjusted cost basis).
There are a number of different cost basis methods used in accounting. Depending on your tax jurisdiction and country, you may be entitled to select your preferred method. In the United States, for instance, the IRS allows taxpayers to choose methods like HIFO, FIFO, or LIFO, provided they can specifically identify the assets being sold. Whatever method you choose, you must use it consistently when calculating your gains or losses. If you are uncertain as to which cost basis method you can use, contact the IRS to confirm.
Note: This template is structured to comply with US tax laws and uses the FIFO (First-In, First-Out) method, the most common accounting approach, which assumes the first assets you acquired are the first ones you sell. This can be advantageous, as selling your longest-held assets may qualify them for lower long-term capital gains tax rates.
What Is the Difference Between Short-Term and Long-Term Crypto Taxes?
The primary difference is the tax rate you'll pay. The rate applied to your capital gain depends on how long you held the asset:
-
Short-Term Gains:
For crypto held for one year or less (Less than 365 days), the profit is taxed at the higher ordinary income tax rate (10% to 37% in the US). -
Long-Term Gains:
For crypto held for more than one year (More than 365 days), the profit is subject to preferential, lower tax rates (0% to 20% in the US).
Prerequisites
Before you start, ensure the following requirements are met to use the template effectively:
-
A Google Account:
You’ll need a Google account to open, copy, and use the template in Google Sheets. This allows you to save your own version and enable Apps Script for live data connections. -
CoinGecko Google Sheets Add-on:
This template uses the official CoinGecko Google Sheets add-on to fetch live and historical crypto prices directly into your spreadsheets using the=COINGECKO()function. -
A CoinGecko API Key:
Required to fetch live crypto prices. The free Demo API key is sufficient to get started, while a paid plan offers higher rate limits for more frequent data refreshes. You can follow our guide to get your free Demo API key.
How to Use the Crypto Tax Calculator Google Sheet Template
This section provides a clear, step-by-step guide on how to integrate and use the Crypto Tax Calculator template effectively. Follow these instructions to set up the CoinGecko add-on, input your transaction history, and view your automatically calculated tax summary.
Setting up the CoinGecko Add-on
First, connect the template to the CoinGecko Google Sheets add-on to enable live and historical price data within the spreadsheet. To get started, install the add-on and configure your API credentials (Subscription Level and API Key) by following the setup guide.
Once configured, all =COINGECKO() formulas across the template will automatically fetch the required data. You don’t need to modify any formulas or configure scripts manually.
Refreshing Crypto Price Data
Now that the CoinGecko add-on is configured, your data will be fetched automatically through the =COINGECKO() formulas across the template.
However, Google Sheets may cache results for a short period of time. If you need the most up-to-date prices, you can manually refresh all data in your sheet. Keep in mind that more frequent refreshes will consume your API call credits faster. If you run into rate limits, consider upgrading to a paid API plan for higher call credits and rate limits.
Note: For tax calculation purposes, most values are based on historical price data retrieved using formulas such as =COINGECKO("id:bitcoin", "2025-12-31"). Once the daily closing price is determined, these values remain fixed, so frequent data refreshes are generally not required.
Once the add-on status is Live, you can start customising the template by adding the tokens you want to track in the following section.
How to Add Specific Coins
To calculate historical values, the template needs the unique API ID for each asset, which you can find on any individual coin page on the CoinGecko website.

Once you have the API ID, simply paste it into cell B4 on the Tax Calculator Sheet. The template will then automatically fetch the correct historical data for your calculations.
Logging your Cryptocurrency’s Transactions in the Tax Calculator Sheet
Once the API key and coin ID are set up, you can begin logging your buy and sell transactions in the “Tax Transaction Log” table. This log is the foundation for calculating your cost basis and capital gains or losses using the FIFO method.
To log your transactions efficiently, you should import the data from your exchange history:
-
Export History from Your Source: Most crypto exchanges and centralized wallets allow you to download your complete transaction history as a CSV file. For on-chain data (e.g., from a MetaMask wallet), you can use a block explorer like Etherscan to view your address and download its transaction history.
-
Filter and Prepare Data: Open your exported CSV file and prepare the essential details required by the template's columns:
-
The Transaction Date and Time.
-
The Asset Name (e.g., "Bitcoin") to help you look up the correct CoinGecko API ID.
-
The Quantity purchased or sold.
-
The Transaction Fee, if applicable.
-
Whether the transaction was a Buy or a Sell.
-
Analyzing Your Crypto Tax Summary
Upon logging your transaction history appropriately, the in-built functions will start running immediately. The CoinGecko API will fetch the precise historical price for each transaction date, and the template will begin calculating your Capital Gains/Losses, separating them into Short-Term and Long-Term categories based on the FIFO method.

This system automatically transforms complex transaction data into auditable, tax-ready figures. You can use the Net FIFO Short-Term Gain and Net FIFO Long-Term Gain figures directly to complete your final tax forms, such as IRS Form 8949 and Schedule D.
To calculate your final tax liability, you must apply the appropriate tax rates to your Net FIFO Short-Term Gain and Net FIFO Long-Term Gain figures. Tax systems, like the one in the US, are often progressive, meaning different portions of your income are taxed at different rates (or 'brackets'). Your final tax payable is the sum of the taxes calculated for each bracket your gains fall into.
While the tax table in this template reflects US rates, the calculator's gain/loss figures can be used in any jurisdiction. Since FIFO is a widely accepted method, you can apply your country's specific tax rates to the net gains calculated by the sheet to determine your liability. To see an estimate of your U.S. federal income tax bracket, navigate to the Read me Sheet. Simply input your annual taxable income into Cell C20 and select your filing status from the dropdown menu in Cell D20.
The tax rate that automatically appears in Cell E20 is the Progressive Tax Rate Ceiling. This represents the highest marginal tax bracket your income falls into. Please note that this is not your effective tax rate and should not be used to calculate your final tax bill. It is an indicator of the highest tax rate applied to only the top portion of your income.
How to Create a Crypto Tax Calculator in Google Sheets
Creating a crypto tax calculator in Google Sheets involves three main components: a reliable source of historical price data, a structured transaction log, and formulas to execute tax calculations.
This template integrates all three into a single system powered by the CoinGecko Google Sheets add-on, allowing you to fetch accurate crypto price data directly using simple =COINGECKO() formulas without any custom scripts.
-
Historical Crypto Price Data
Accurate price data is fetched directly using the CoinGecko Google Sheets add-on through the=COINGECKO()function. This allows the template to retrieve the Fair Market Value (FMV) of assets on specific transaction dates, which is essential for calculating cost basis and capital gains. -
Structured Transaction Logging
A detailed log sheet to record transaction input, such as quantities bought or sold, dates, and fees. -
Google Sheets Formulas and Tables
Advanced Sheets formulas are used to calculate and classify every taxable event instantly. These nested calculations determine the specific cost basis consumed by a sale, calculate the resulting Capital gain or loss, and classify it as Short-Term or Long-Term.
This connected system ensures that every metric, from your original cost basis to your final net gain, is calculated dynamically and accurately.
How to Get Historical Crypto Data in Google Sheets
You can fetch historical crypto data in Google Sheets using two different approaches, depending on your preferred level of control and customization:
Option 1 (Recommended): Using the CoinGecko Add-on
The simplest way is to use the CoinGecko Google Sheets add-on with the =COINGECKO() function. This method is fully integrated into the template and does not require any scripting, allowing you to fetch live or historical crypto data directly, for example, retrieving the price of Bitcoin on a specific date with (=COINGECKO("id: bitcoin", "price", DATE(2024,12,31)).
Option 2 (Advanced): Using Apps Script
For users who require more flexibility, you can fetch data directly from the CoinGecko API using Google Apps Script. This approach gives you fine-grained control over the request parameters, such as specifying dates, currencies, and endpoints, as well as how the returned data is structured and used within your sheet.
You can get historical crypto data in Google Sheets by creating custom functions that call the CoinGecko API’s /coins/{id}/history endpoint.
Step 1: Create an ImportJSON Script
First, create the main function that will fetch and parse data from CoinGecko API.
Open your Google Sheet and navigate to ‘Extensions’ and select ‘Apps Script’ - a new tab will appear.
On the left panel, select ‘< > Editor’ and add a new script using the ‘+’ button. Copy and paste the following importJSON script, and save the script as ‘ImportJSON’. This importJSON script is a versatile one that will allow you to import data in many different ways.
Step 2: Create the autoRefresh Script
Next, create a helper script that will allow the data to refresh automatically.
Create a second Apps Script by clicking on the ‘+’ button. Copy the code below and paste it into the script editor, saving it as ‘autoRefresh’ – this will allow your sheet to automatically refresh at fixed intervals.
Step 3: Call the Function in Your Sheet
With the scripts saved, you can now use the =IMPORTJSON() function in any cell.
-
Construct your CoinGecko API request URL.
-
Enter the formula into your desired cell, replacing the placeholder URL with your own.
For example, to get the price of Bitcoin on 30-12-2023, your formula would look like this:
=IMPORTJSON("https://api.coingecko.com/api/v3/coins/bitcoin/history?date=30-12-2023&x_cg_demo_api_key=YOUR_API_KEY,"/market_data/current_price/usd","noTruncate")This method is modular and powerful, as the =IMPORTJSON() formula can be easily replicated across any cell with different API endpoints. For a more detailed step-by-step guide, read our article on importing crypto prices into Google Sheets.
The Calculation Logic
Once your transaction data is logged, the spreadsheet automatically calculates your capital gains or losses using the core formula:
Proceeds - Adjusted Cost Basis = Capital Gain/Loss
Here’s a step-by-step breakdown of how the template applies this logic using the FIFO method:
-
Trigger Criteria:
When you log a "SELL" transaction, the formulas begin searching for the corresponding "BUY" transaction to determine the cost basis. -
Applying the FIFO Rule:
Following the First-In, First-Out rule, the template locates the earliest "BUY" transaction in your log that still has an unspent quantity. This is the specific "lot" being sold. -
Determine the Adjusted Cost Basis:
For that specific lot, the Adjusted Cost Basis is calculated by adding the original purchase price to any associated transaction fees
Purchase Price + Fees -
Calculate Gains or Loss:
The template then subtracts this Adjusted Cost Basis from your Sale Proceeds (the sale price minus any sale fees). The result is your realized capital gain or loss for that trade. -
Holding Period Categorization:
Finally, the template calculates the time between the purchase date and the sale date of that specific lot. If the period is more than 365 days, the gain or loss is categorized as Long-Term; if it is 365 days or less, it is categorized as Short-Term.
Common Issues & Fixes
If you encounter errors while using the tax calculator and are unsure what’s causing the issue, navigate to ‘Extensions’ > ‘CoinGecko’ > ‘View Error Logs’ to access the debug logs and view the returned error code and message.
Once you’ve identified the issue, here are a few common problems along with quick ways to fix them.
-
API Rate Limit (Error 429)
This happens when the free CoinGecko Demo API hits its request limit. Wait a few minutes before refreshing again, or switch to a Pro API key for uninterrupted updates.
If you receive other error codes, refer to the full list of CoinGecko API status codes to troubleshoot them. -
API Key or Connection Issues
If your data isn’t loading or you’re seeing errors such as 401 or 403, try reconnecting your CoinGecko API key within the add-on settings and ensure your subscription level is correctly configured. -
Data Not Updating or Showing Older Prices
Google Sheets may cache formula results temporarily. To refresh your data, open the CoinGecko sidebar and click “Refresh All Data” to force-update all=COINGECKO()formulas. -
Inaccurate Gain/Loss Calculations
This happens when the transactions were not entered in chronological order, which breaks the sequential logic of the FIFO formulas. Sort your entire transaction log by date to ensure the FIFO engine works correctly:-
Click on the Downward arrow on the “Transactions Date & Time” Cell.
-
Navigate to “Sort Column” > “Sort A to Z”.
-
For more detailed troubleshooting steps and a list of common errors, refer to the Error Debugging Guide.
Further Enhancements
You can further enhance this Crypto Tax Calculator spreadsheet to better suit your needs. Here are a few ideas that leverage other CoinGecko API endpoints:
-
Fetch Historical Price Data
Pull Historical Prices for specific coins for more in-depth performance analysis. You can follow our guide on how to pull crypto historical data in Google Sheets and visualize long-term trends. -
Add OHLC (Open, High, Low, Close) Data
If you want more granular price insights, consider fetching OHLC data for each coin. Check out our step-by-step guide on how to pull crypto OHLC data into Google Sheets. -
Add a Crypto Portfolio Tracker
Extend the spreadsheet into a complete Crypto Portfolio Tracker to monitor unrealized P&L (the current profit/loss of assets you still hold) alongside your realized tax gains. For a full guide, see our article on how to create a crypto portfolio tracker in Google Sheets. -
Create a Crypto Exit Strategy Planner
To complement your tax planning, you can build a Crypto Exit Strategy Planner. Planning your exits strategically may help optimize your returns, which in turn impacts your final tax calculations. Check out our step-by-step guide on how to build a crypto exit strategy planner in Google Sheets.
Conclusion
A clear and auditable tax report is crucial for any crypto investor. This free Crypto Tax Calculator Google Sheets template, powered by the CoinGecko API offers a streamlined solution to determine your capital gains.
Reporting taxes with data from a reputable, industry-trusted source is essential to avoid potential discrepancies that invite scrutiny by tax authorities. Our template helps simplify the complex process of tracing asset cost basis across trades using reliable, aggregated historical data.
If you need more historical data beyond the Demo API's limits, higher rate limits and call credits, or access to exclusive endpoints, consider subscribing to a paid API plan.
Reminder: Consult a Tax Professional
Cryptocurrency tax regulations, particularly those involving DeFi and cross-border activity, are complex and constantly evolving. Users must be aware that crypto tax jurisdictions and methodologies vary by country or region. Confirm and apply the correct rules for your locale, and always consult a qualified tax professional to ensure accurate filing and to identify strategic tax optimization opportunities.

Ethereum Mainnet
Base Mainnet
BNB Smart Chain
Arbitrum
Avalanche
Fantom
Flare
Gnosis
Linea
Optimism
Polygon
Polygon zkEVM
Scroll
Stellar
Story
Syscoin
Telos
X Layer
Xai