How to Calculate Cost Basis for Crypto

Last Updated on April 4, 2026 by Patrick Camuso, CPA

Quick answer (read this first)

The formula for how to calculate cost basis for crypto: Cost basis = purchase price + capitalized transaction fees, assigned to a specific tax lot at the time of acquisition.

What changes the calculation: How the asset was acquired, whether bought, earned, or received, determines what number goes into basis and when.

What method matters: FIFO or specific identification, applied per wallet or account, determines which lots are relieved on disposal. Strategies like HIFO and LIFO are implemented through specific identification via standing instructions, not as separate methods.

What breaks in practice: Transfers misclassified as sales, income events with undocumented valuations, and missing acquisition history all produce a calculated basis that does not match actual defensible basis.

The Basic Calculation

This guide covers the calculation mechanics for investors, traders, and Web3 participants who need to calculate and substantiate crypto cost basis across exchanges, wallets, and DeFi activity.

Cost basis for a purchased digital asset is the total amount paid to acquire it, including any transaction fees that are capitalized rather than deducted as expenses.

The formula:

Cost basis = purchase price + capitalized transaction fees

A taxpayer who paid $10,000 for one Bitcoin and paid a $50 exchange fee on that transaction has a cost basis of $10,050 for that lot. The acquisition date is the trade date. The holding period begins the day after acquisition. That lot, one Bitcoin at $10,050 basis with its specific acquisition date, carries forward in the inventory until disposal. On sale, the gain or loss is the amount realized minus that $10,050.

Every transaction fee associated with an acquisition should be capitalized into the basis of the asset acquired. The IRS uses the term “digital asset transaction costs” to refer to amounts paid for services provided by another to effect the purchase, sale, or disposition of a digital asset. These include transaction fees, gas fees, transfer taxes, and commissions. Fees paid on disposals reduce the amount realized rather than increasing basis, but the practical effect on taxable gain is the same.

One important exclusion, amounts paid for transaction services to effect a transfer of digital assets between the taxpayer’s own wallets or accounts are not digital asset transaction costs and are not capitalized into basis. Those fees do not increase the basis of the transferred asset.

How to Calculate Cost Basis by Acquisition Type

The formula changes depending on how the asset was acquired.

Purchased on an Exchange

Basis equals the purchase price plus any capitalized fees. For exchange purchases, the fee is typically displayed as a separate line item in the transaction detail. Both the purchase amount and the fee should be pulled from the exchange record, not reconstructed from memory.

If partial fills are involved and an order executes across multiple fills at slightly different prices, the basis is the weighted average execution price across all fills for that order, plus fees. The underlying lot derives from the actual execution record and broker confirmation, not an after-the-fact estimate.

Received as Compensation

Staking rewards, mining income, liquidity mining distributions, and token grants establish basis at fair market value when the taxpayer gains dominion and control over the assets, which in most fact patterns means when the rewards are credited or received. That same value is recognized as ordinary income at that time. For digital assets received by an independent contractor for performing services, the fair market value at receipt also constitutes self-employment income subject to self-employment tax.

The calculation:

Cost basis = fair market value at time of receipt (when dominion and control is established)

Fair market value is typically the spot price on a recognized exchange at the time the asset was credited to the taxpayer’s wallet or account. The specific timestamp matters. For assets with significant intraday volatility, the difference between a price pulled at midnight versus the actual receipt time can be material. The applicable timing depends on the specific facts, which can differ across protocol staking, validator staking, and exchange staking arrangements.

For thinly traded tokens without deep exchange markets, fair market value may require a more considered analysis of available pricing data. The valuation methodology should be documented and applied consistently.

Received Through Hard Forks and Airdrops

Under the IRS’s published position, when a taxpayer receives units following a hard fork via an airdrop and has dominion and control over those units, ordinary income is recognized at the fair market value of the assets received, and that recognized amount becomes the basis. The income recognition and basis establishment framework follows the same structure as other compensation-type receipts.

Edge cases exist around the factual timing of access and when dominion and control is actually established, particularly where a taxpayer lacks immediate access to the new units or where the assets are not yet tradeable. Those fact-specific questions affect the timing of income recognition and therefore the timing of basis establishment. The basic framework, that dominion and control triggers income and recognized income becomes basis, is the IRS’s stated position and should be the starting point for any hard fork or airdrop analysis.

Acquired Through DeFi Protocol Interactions

Liquidity pool deposits, wrapped token conversions, bridge transactions, and protocol-level exchanges each require classification before basis can be calculated.

If the event is treated as a taxable disposal, the asset disposed of has a recognized gain or loss, and the new asset received establishes basis at its fair market value at the time of receipt. If the event is treated as a nontaxable transfer, the original basis carries through to the new asset. The classification controls the calculation.

The treatment of transaction fees in a crypto-for-crypto exchange follows a specific rule that differs from a standard cash purchase. When digital assets are exchanged for other digital assets in a taxable transaction, the fees paid to effect that exchange are allocable to the disposed asset side. They reduce the amount realized on the asset given up and cannot be added to the basis of the asset received. This is the opposite of how acquisition fees work in a cash purchase, where fees are capitalized into the basis of the asset acquired. The distinction matters for any DeFi swap, token exchange, or conversion that is treated as a taxable disposal.

This is one of the primary areas where different software platforms diverge. The same DeFi interaction can produce different basis outcomes depending on whether the platform treats it as a taxable exchange or a nontaxable transfer.

Inherited Crypto

Inherited digital assets receive a stepped-up basis to fair market value on the date of the decedent’s death, or the alternate valuation date if elected. The recipient does not inherit the decedent’s original acquisition cost. The basis resets at the date-of-death value.

Gifted Crypto

The basis of gifted crypto depends on whether the recipient sells at a gain or a loss relative to the donor’s basis. If sold at a gain, the recipient uses the donor’s original basis. If sold at a loss, the recipient uses the lower of the donor’s basis or the fair market value at the date of the gift. The donor’s holding period carries over if the recipient uses the donor’s basis.

The carryover basis rule is only useful to the extent the donor’s basis can actually be substantiated. In practice, many crypto gifts lack documentation of the donor’s original acquisition cost. Where donor basis is unknown or unverifiable, the recipient may be unable to establish carryover basis and must rely on the best available evidence. Absent substantiation, the IRS may treat basis as zero.

How the Calculation Works on Disposal

On disposal of a digital asset, the gain or loss calculation requires two numbers, the amount realized and the adjusted basis of the lots relieved.

Amount realized = proceeds minus any selling fees

Gain or loss = amount realized minus adjusted basis of lots relieved

Holding period = from the day after acquisition of the specific lots relieved to the date of disposal

The holding period governs whether gain is short-term (held one year or less) or long-term (held more than one year), which determines the applicable tax rate.

How the Method Affects the Calculation

Which lots are relieved on disposal, and therefore what basis is subtracted, depends on the accounting method applied.

Under current IRS guidance, there are two permitted methods, both applied at the wallet or account level, FIFO and specific identification.

FIFO (first-in, first-out): The earliest-acquired lots are treated as disposed of first. No lot-level documentation is required, but there is no flexibility in which lots are relieved. In a portfolio where early acquisitions carry lower basis than recent ones, FIFO typically produces larger recognized gains.

Specific identification: The taxpayer designates exactly which lots are relieved at the time of each disposition. This allows strategic lot selection, choosing lots with higher basis, longer holding periods, or loss positions, but requires contemporaneous documentation of the lot identification at the time of the transaction. Without that documentation, the IRS treats the position as FIFO.

Strategies such as HIFO (highest-in, first-out) and LIFO (last-in, first-out) are not separate permitted methods. They are lot selection approaches executed through specific identification, implemented via standing instructions that direct the platform to select lots in a defined order before each transaction executes. To use HIFO or LIFO, specific identification must be properly maintained and the standing instruction must be in place before disposal, not applied retroactively.

The final ordering rules under the digital asset regulations apply to acquisitions and dispositions on or after January 1, 2025. Revenue Procedure 2024-28 provides the transition mechanism, a safe harbor for allocating previously unattached basis into wallet- or account-level tracking for taxpayers who were using a universal pooling approach. Universal pooling across all wallets and exchanges is no longer permitted going forward. Taxpayers who did not complete the safe harbor allocation are still required to use wallet- and account-level tracking for 2025 and subsequent years, but without the penalty protection the safe harbor provided.

One additional distinction matters for investors with self-custody activity since the broker-specific identification relief provided under Notice 2025-7 applies to broker-held units, not to units held in self-custody wallets. For non-broker-held positions, the standard specific identification documentation requirements apply without the additional relief available through brokers. For a full breakdown of method selection and the Rev. Proc. 2024-28 transition, see our guide to choosing the right crypto cost basis method.

What Has to Be Tracked to Calculate Correctly

An accurate cost basis calculation depends on having the right inputs. Those inputs come from complete, reconciled records.

For each acquisition:

  • Asset and quantity acquired
  • Date and time of acquisition
  • Purchase price or fair market value at receipt
  • Transaction fees paid at acquisition
  • Source (exchange record, on-chain transaction, income documentation)

For each transfer between wallets or accounts:

  • The transfer must be matched to its origin and destination
  • A wallet-to-wallet transfer is not a taxable event and does not create a new lot
  • Unmatched transfers are the most common source of basis calculation errors: a withdrawal treated as a sale creates phantom gain, and an unmatched deposit treated as a new acquisition with zero basis understates the true cost

For each disposition:

  • The specific lot or lots being relieved (required for specific identification; implied by FIFO)
  • Date and time of disposal
  • Amount realized
  • Transaction fees at disposal

If any of these inputs are missing, estimated, or incorrectly classified, the calculation produces a result that does not reflect actual basis, regardless of how precisely the formula is applied.

Where Calculations Break Down in Practice

The formula is simple. The data is not.

Missing acquisition history is the most common failure point. If an exchange has no record of an acquisition, because the asset was purchased years ago, the exchange closed, or the CSV export was incomplete, the software assigns zero basis or omits the lot entirely. The calculation proceeds, but the basis figure is wrong.

Undocumented income events create the same problem. Staking rewards and airdropped tokens that were never recognized as income have no documented basis. When those assets are later sold, the gain is calculated from zero rather than from the correct fair market value at receipt.

Misclassified transfers distort the inventory. When a wallet-to-wallet movement is treated as a sale, the software records phantom gain, removes the lot from inventory, and creates a new lot at the deposit address with no acquisition history. The subsequent sale of that asset calculates against zero basis because the original lot is no longer in the inventory where it should be.

Valuation gaps affect income-type acquisitions. If fair market value at receipt was not documented at the time and is reconstructed later, the basis figure depends on the accuracy of the reconstruction and the pricing source used. Inconsistent or undocumented valuation methodology creates basis figures that cannot be verified.

These failures are not always visible from the gain and loss report. They are visible at the lot level. A defensible position requires that each disposition can be traced to a specific acquisition lot with documented basis and continuity across transfers. This risk is most acute in self-custody environments, where no third-party reporting exists to anchor the taxpayer’s position.

Differences in transaction timing conventions across platforms can also create reconciliation mismatches even where the underlying calculation is correct.

Calculated Basis vs Defensible Basis

Software can calculate a number from whatever data it has. That number is not a defensible tax position.

Calculated basis is the output of a software platform applied to the data it received, including incomplete imports, default assumptions for missing history, and unverified transfer matches. The platform produces a gain figure. That figure may or may not reflect what actually happened.

Defensible basis requires source documentation for every acquisition including exchange records, on-chain transactions, and income documentation. It requires matched and reconciled transfers so that every movement between wallets is verified and lots are not misclassified as sales. It requires documented valuations, with fair market value at receipt supported by a consistent and verifiable methodology. And it requires lot-level traceability, meaning every disposition traceable back to a specific acquisition lot with continuity across the full history.

As IRS matching systems compare broker-reported proceeds to taxpayer-reported gain, unsupported basis will surface as discrepancies. A calculated basis that cannot be traced back to evidence is a number. It is not a tax position that can be defended.

For a deeper look at how these errors embed and compound over time, see our article on crypto cost basis issues and why they break down.

Broker Reporting and Noncovered Assets

Even with a Form 1099-DA from a broker, taxpayers still need their own lot-level records.

For the 2025 tax year, brokers were required to report gross proceeds from digital asset sales but were not required to report cost basis. Basis reporting becomes mandatory only for covered digital assets sold on or after January 1, 2026. Noncovered assets, which includes most assets with acquisition history that predates the broker’s tracking or that were moved between custodians, generally will not carry required basis reporting even after that date.

A transfer out of a broker account breaks covered status for the transferred lot. Once an asset moves to a self-custody wallet or a different platform, the receiving account has no tracked acquisition information. That lot is noncovered at the new location, and basis reporting for it is generally not required and typically not possible from the broker perspective. The taxpayer must maintain their own records to establish basis continuity across the transfer.

The compliance picture is further complicated by the existence of three independent records that describe the same economic activity but were never designed to reconcile with each other which are the on-chain transaction record, the output of whatever software or accounting method the taxpayer uses to calculate gains and income, and what the broker reports to the IRS on Form 1099-DA. Each reflects different data, different timestamps, different classification logic, and different scope. A 1099-DA reconciliation is not a plug-and-play exercise. It is the process of aligning all three records, resolving discrepancies, and ensuring that the return reflects the correct substantiated position. The taxpayer’s own lot-level records are the only layer that bridges all three.

A 1099-DA tells the IRS what was received from a sale. It does not tell the IRS what was paid. If the taxpayer’s records cannot supply a defensible basis for every lot disposed of, the IRS sees proceeds with no corresponding cost. The obligation to calculate and substantiate basis remains with the taxpayer regardless of what the broker does or does not report.

When Calculation Requires Reconstruction

If records are complete and reconciled, cost basis calculation is a mechanical process. If records have gaps, missing exchange history, untracked wallet activity, or unreconciled transfers, calculation shifts to reconstruction.

Reconstruction means working through the available evidence in priority order with exchange records and on-chain data first, then secondary sources such as email confirmations and bank funding records, then any contemporaneous taxpayer documentation. Where gaps remain after exhausting available sources, conservative assumptions are applied and documented in a formal assumptions register.

The output of a defensible reconstruction is a lot-level inventory schedule that can be traced back to documented evidence for every lot, not a software-generated gain summary that cannot explain where the basis figures came from. If records are incomplete, calculation alone will not produce a defensible result. At that point, the process shifts from calculation to reconstruction.

Most common cost basis mistakes:

  • Treating wallet-to-wallet transfers as taxable sales, which creates phantom gain and breaks the lot chain
  • Missing staking and airdrop income, leaving those lots with zero or unsupported basis
  • Applying HIFO or other specific identification strategies without contemporaneous lot documentation, which defaults the position to FIFO
  • Losing acquisition history through exchange closures, incomplete exports, or untracked self-custody, which forces reconstruction under the best available evidence standard

For investors whose transaction history spans multiple years, multiple platforms, or includes DeFi and self-custody activity that was never reconciled, calculation alone is not sufficient. Our crypto cost basis reconstruction services are built for exactly this scenario. Work with a crypto CPA established in this market since 2016.

Contact us to discuss your situation

Frequently Asked Questions

How do I calculate cost basis for crypto I bought at different prices?

Each purchase establishes a separate tax lot with its own basis and acquisition date. The prices are not averaged together unless an averaging method is being applied, which is not a permitted method for digital assets under current IRS guidance. Each lot keeps its specific purchase price plus fees. On sale, which lot’s basis is used depends on the accounting method applied: FIFO uses the earliest-acquired lot first; specific identification allows deliberate lot selection.

Does the transaction fee get added to cost basis?

Yes, when the fee is paid at acquisition. Transaction fees paid to acquire a digital asset are capitalized into the basis of the asset acquired. A $10,000 purchase with a $50 fee produces a $10,050 basis. Fees paid at the time of disposal reduce the amount realized rather than increasing basis, but the net effect on gain is the same. Fees paid to transfer assets between the taxpayer’s own wallets are not digital asset transaction costs under current IRS guidance and do not affect the basis of the transferred asset.

How do I calculate cost basis for crypto received as staking rewards?

Staking rewards establish basis at fair market value when the taxpayer gains dominion and control over the assets, in most cases when the rewards are credited to the wallet or account. That same value is recognized as ordinary income at that time. The basis equals the amount recognized as income. If the staking reward was 0.1 ETH and the fair market value when it was credited was $200, the basis of that lot is $200 and $200 of ordinary income was recognized at that time. The precise timing of dominion and control can vary depending on whether staking occurs directly on-chain, through a validator, or through an exchange.

What happens to cost basis when I transfer crypto between my own wallets?

A transfer between wallets under the same taxpayer’s control is not a taxable event and does not change the basis. The original tax lot, with its original basis and acquisition date, moves to the new wallet. The transfer must be properly recorded so the lot is not misclassified as a sale or treated as a new acquisition at zero cost. Fees paid to effect the transfer are not digital asset transaction costs under current IRS guidance and do not affect the basis of the transferred asset.

How does FIFO affect my cost basis calculation?

Under FIFO, the earliest-acquired lots are treated as disposed of first. On sale, the gain is calculated using the basis of the oldest lots. In a portfolio where early acquisitions have lower basis than recent ones, FIFO typically produces larger recognized gains. FIFO is the default when specific identification documentation is not maintained. Using a different lot selection approach, such as selecting highest-basis lots first, requires specific identification with standing instructions established before the transaction executes, not applied after the fact.

Can I use average cost basis for crypto?

No. Average cost basis is not a permitted method for digital assets under current IRS guidance. Taxpayers must apply FIFO or specific identification at the wallet or account level. Using an average cost approach on a crypto tax return is not a defensible position.

How are transaction fees treated when I swap one crypto for another?

In a crypto-for-crypto exchange treated as a taxable disposal, the fees paid to effect the swap are allocable to the asset being given up. They reduce the amount realized on the disposed asset and cannot be added to the basis of the asset received. This differs from a cash purchase, where acquisition fees are capitalized into the basis of the asset acquired. The practical consequence is that in a taxable swap, fees reduce the gain on the disposed side rather than increasing the basis of what was received. Fees paid to transfer assets between the taxpayer’s own wallets are not digital asset transaction costs and do not affect basis.

Floating