What Happens to Your Cost Basis When You Use DeFi
Every DeFi interaction changes your cost basis. Deposits, withdrawals, swaps, staking, and LP positions all affect what you paid and what you owe. Here's how.

You buy 10 ETH on Coinbase for $2,000 each. Total cost basis: $20,000. Then you start using DeFi.
You deposit the ETH into Aave. You receive aETH. You earn yield for three months. You withdraw the ETH plus interest. You swap half of it for USDC on Uniswap. You stake the other half on Lido and receive stETH. Six months later, you sell everything.
When you sell, what is your cost basis?
If you cannot answer that question with a specific number for each asset you hold, your P&L is wrong and your tax filing is a guess. Every DeFi interaction in that chain changed your cost basis in a specific way, and getting any one of them wrong cascades through every calculation that follows.
Here is what actually happens to your cost basis at each step.
Depositing Into a Lending Protocol
When you deposit 10 ETH into Aave, you receive 10 aETH (Aave's receipt token). This is not a sale. You are not disposing of your ETH in the traditional sense. You are exchanging it for a receipt token that represents your claim on the deposited asset plus future interest.
The cost basis of your aETH is the fair market value of the ETH you deposited. If your 10 ETH had a cost basis of $20,000 (what you originally paid on Coinbase), and ETH is worth $2,500 at the time of deposit, the tax treatment depends on how you classify the transaction.
Under the conservative approach (which most tax software uses), the deposit is a taxable event. You disposed of ETH with a $20,000 basis and received aETH worth $25,000. That is a $5,000 capital gain. Your aETH now has a cost basis of $25,000.
Under an alternative approach, the deposit is treated as analogous to a bank deposit or a loan collateral arrangement, which would not be a taxable event. Under this treatment, the cost basis of your ETH ($20,000) carries directly into the aETH without triggering a gain.
The IRS has not issued specific guidance on whether receiving receipt tokens from DeFi lending protocols is a taxable exchange. Both positions are used by real CPAs. The conservative approach is safer if you are uncertain. Whichever position you take, apply it consistently.
For the rest of this article, we will use the conservative approach to illustrate how cost basis flows through DeFi interactions, since it creates the most complex tracking requirements.
(For more on how the IRS treats DeFi interactions, see our DeFi tax guide.)
Earning Yield on a Lending Position
While your ETH is deposited on Aave, your aETH balance increases over time as interest accrues. Aave uses a rebasing mechanism, so your balance of aETH grows continuously. After three months, you might have 10.15 aETH instead of 10. For a detailed breakdown of cost basis on lending positions across Aave V3, Aave V4, Compound V2 cTokens, and Compound III — including a worked 18-month example of how principal and interest income split at withdrawal — see our lending position tracking guide.
That additional 0.15 aETH is income. Under Rev. Rul. 2023-14, the IRS treats rewards received through staking (and by extension, lending yield that accrues as new tokens) as ordinary income at fair market value when you gain dominion and control.
The timing of income recognition depends on how the protocol works. For Aave, the aETH balance increases with every block. In practice, most tax professionals recommend recognizing the income at reasonable intervals (daily, weekly, or at withdrawal) rather than per-block, because per-block accounting is impractical.
Each increment of yield creates a new tax lot. If your aETH balance increased by 0.15 over three months while ETH ranged from $2,500 to $3,000, the income amount depends on the fair market value at the time each increment was received.
0.15 aETH earned over 3 months while ETH ranged from $2,500 to $3,000
Each portion of the 0.15 aETH creates its own tax lot with basis equal to FMV at time of receipt.
When you eventually sell that 0.15 aETH (or the ETH you receive when you withdraw it), any additional gain or loss above the income amount is a separate capital gain or loss.
Withdrawing From a Lending Protocol
When you withdraw from Aave, you return your aETH and receive ETH. You deposited 10 and earned 0.15 in interest, so you receive 10.15 ETH back.
This withdrawal is another taxable event under the conservative approach. You are disposing of aETH (one asset) and receiving ETH (a different asset). The gain or loss on the disposal of the aETH is calculated against the cost basis of each aETH lot you hold.
Your original 10 aETH had a cost basis of $25,000 (set at the time of deposit). The 0.15 aETH earned as yield had a cost basis equal to the income recognized at the time each increment was received (approximately $400 total). When you withdraw, the fair market value of the 10.15 ETH you receive becomes the cost basis of that ETH going forward.
Return 10.15 aETH, receive 10.15 ETH
New ETH cost basis: $30,450 (FMV at withdrawal), split across 10.15 lot units.
Swapping on a DEX
You take half your ETH (5.075 ETH worth $15,225 at $3,000 per ETH) and swap it for USDC on Uniswap.
This is straightforward: a swap is a taxable disposal. You sold 5.075 ETH and received USDC. The gain or loss depends on the cost basis of the specific ETH lots consumed by the sale.
If those 5.075 ETH came from the withdrawal (cost basis of $3,000 each, since that was the FMV at withdrawal), and you swapped at $3,000, the capital gain on the swap is approximately zero (minus the gas fee and any price slippage during the swap).
Your USDC now has a cost basis equal to the fair market value of the ETH you gave up, minus any fees. If you received 15,200 USDC after fees, your cost basis on that USDC is $15,200. The cost basis mechanics for stablecoins in DeFi get even more fragmented. See our full breakdown of stablecoin tax treatment.
The gas fee paid in ETH for the swap transaction is a separate taxable disposal. If the swap cost 0.003 ETH in gas ($9), that 0.003 ETH runs through your FIFO lot queue, and the gain or loss on that small disposal is included in your P&L. This happens on every on-chain interaction, not just swaps. For a full breakdown of how gas fees hit your FIFO queue across different transaction types and why most trackers miss them entirely, see our guide on why gas fees are taxable disposals.
(For more on how swaps and gas fees are treated, see our cost basis guide.)
Staking and Receiving Liquid Staking Tokens
You stake the other 5.075 ETH on Lido and receive 5.075 stETH.
This is another asset exchange. You disposed of ETH and received stETH. The cost basis of your stETH is the fair market value of the ETH at the time of the stake. If ETH is still $3,000, your stETH has a cost basis of $15,225.
Whether staking through liquid staking protocols like Lido is a taxable event is an area of ongoing debate. Some tax professionals argue it is similar to depositing into a lending protocol (a taxable exchange of one asset for another). Others argue it is more analogous to wrapping ETH into WETH, which some practitioners treat as a non-taxable event. The IRS has not issued specific guidance on liquid staking token exchanges. The conservative approach (and the one most tax software uses) is to treat it as a taxable disposal. Consult a tax professional for your specific situation.
If your ETH had a cost basis of $3,000 per unit (from the Aave withdrawal) and stETH is also worth $3,000, the gain is approximately zero. But the cost basis of your stETH is now anchored to the FMV at the time of staking, not the original purchase price on Coinbase.
Once you hold stETH, Lido rebases your balance daily. Each rebase increment is income at fair market value when received, following the same logic as Aave yield. If your stETH balance grows from 5.075 to 5.1 over a month, that 0.025 stETH is approximately $75 in ordinary income (at $3,000 per ETH), and it creates a new tax lot with a $75 cost basis.
(For more on how staking rewards are tracked across protocols, see our DeFi tracking guide.)
Providing Liquidity on Uniswap v3
Providing liquidity adds another layer of complexity. When you deposit two tokens into a Uniswap v3 pool, you receive an NFT that represents your concentrated liquidity position.
This is a disposal of both tokens in exchange for the LP NFT, under the conservative approach. The cost basis of the LP NFT is the combined fair market value of the two tokens you deposited. If you deposited 2 ETH ($6,000) and 6,000 USDC ($6,000), the LP NFT has a cost basis of $12,000.
Some tax professionals argue the alternative position: that providing liquidity is more like a loan (you have not permanently given up the tokens, and you will receive them back when you exit), making the deposit non-taxable. The IRS has not ruled specifically on LP token treatment. As with lending protocol deposits, the conservative approach treats it as a taxable exchange and is the safer position if you are uncertain.
Under the conservative approach, the capital gain or loss on the deposit depends on the cost basis of each token you gave up versus the fair market value at the time of deposit. The ETH you deposited might have had a cost basis of $5,000 (from earlier purchases), so depositing it at $6,000 fair market value creates a $1,000 gain. The USDC had a basis equal to its value ($6,000), so no gain or loss there.
While your liquidity is active, the composition of your position changes as trades flow through your price range. You might have deposited 50/50 ETH and USDC, but by the time you withdraw, you could have 80% USDC and 20% ETH (or vice versa). This impermanent loss (or gain) is not a taxable event while the position is open. It is only realized when you withdraw. For a full breakdown of what trackers get wrong about LP positions — including how impermanent loss, accrued fees, and cost basis interact — see our liquidity pool tracking guide.
Trading fees earned by your LP position accrue inside the NFT. These are generally treated as income when claimed, not when earned. The cost basis of the fee tokens is the FMV at the time you claim them.
When you withdraw your liquidity (burn the NFT), you receive the underlying tokens at their current ratio. This is a disposal of the LP NFT in exchange for the tokens. The capital gain or loss is the difference between the fair market value of the tokens received and the cost basis of the LP NFT.
Bridging Across Chains
If at any point you bridge assets across chains (for example, bridging ETH from Ethereum to Arbitrum), the cost basis treatment depends on how the bridge works.
Most bridges lock your asset on the source chain and mint a wrapped version on the destination chain. This is technically an exchange of one asset for a different asset (ETH on Ethereum for WETH on Arbitrum). The conservative treatment is a taxable disposal, though many practitioners argue it should be treated as a non-taxable transfer since the economic substance has not changed.
Regardless of the tax treatment, the cost basis needs to follow the asset across the bridge. If your ETH had a cost basis of $2,000 and you bridge it to Arbitrum, the wrapped ETH on Arbitrum should carry the $2,000 cost basis forward. If your tracker resets it to FMV at the time of the bridge, your future P&L is wrong.
The gas fee on the bridge transaction is a taxable disposal of the native token on the source chain, processed through your FIFO lot queue on that chain.
(For a deep dive into how bridging between chains breaks cost basis, how wrapped tokens complicate tracking, and how bridge fees are handled, see our bridge cost basis guide. For transfer cost basis more broadly, see our transfer guide.)
The Cumulative Effect
Here is why DeFi cost basis is so difficult. Each interaction changes the basis, and each change depends on getting the previous step right.
Starting with 10 ETH at $20,000 cost basis, after a full DeFi cycle your cost basis has been transformed multiple times: reset at Aave deposit, split by yield accrual, reset again at withdrawal, divided by the Uniswap swap, reset at the Lido stake, and incremented by staking rebases. Each step created new tax lots, recognized income, or generated capital gains.
If your tracker gets the Aave deposit wrong (treating it as a non-taxable transfer instead of an asset exchange), every subsequent cost basis is wrong. If it misses the yield income, your lot queue is incomplete. If it treats the staking as a non-event when your CPA treats it as a disposal, the numbers diverge.
The only way to get an accurate P&L at the end is to get every step right from the beginning. That requires a tracker that understands each protocol's mechanics and applies the correct cost basis treatment at each interaction. DeFi cost basis now follows the same per-wallet rule that applies to every other crypto holding. See the full wallet-by-wallet breakdown.
How Cryptofolio Handles DeFi Cost Basis
Cryptofolio tracks cost basis through every DeFi interaction using protocol-specific parsing logic.
When you deposit ETH into Aave, the system records it as a lending deposit, captures the cost basis of the ETH being deposited, and creates a new lot for the aETH received at the fair market value of the deposit. Yield accrual is tracked and classified as income at FMV. When you withdraw, the aETH disposal is calculated against the correct lots, and the returned ETH gets a new cost basis at FMV.
Swaps on Uniswap or other DEXs are classified as disposals with the correct lot consumption from your per-wallet FIFO queue. Gas fees on every interaction run through the native token's lot queue as separate disposals.
For staking, Cryptofolio tracks each rebase increment as an income event with its own tax lot. When you eventually sell stETH or unstake, the capital gain is calculated against the correct basis for each lot.
For protocols Cryptofolio does not yet support, transactions are flagged for review. You can manually classify the interaction and enter cost basis. When the protocol is added, the on-chain data replaces your manual entry automatically.
All of this is tracked per wallet, per chain, in compliance with Rev. Proc. 2024-28.
DeFi changes your cost basis at every step. Track it like it.
Cryptofolio maintains cost basis through deposits, withdrawals, swaps, staking, yield accrual, and LP positions so your P&L reflects what actually happened.
The Bottom Line
Every DeFi interaction is a cost basis event. Deposits create new lots. Yield creates income and new lots. Withdrawals trigger disposals. Swaps consume lots and create new ones. Staking rebases add incremental income. LP positions split and recombine basis across multiple tokens. For a detailed look at how staking rewards create individual lots, why per-wallet tracking matters for stakers, and what most trackers get wrong, see our guide on how staking rewards create new lots across wallets.
If your tracker treats DeFi as a black box where ETH goes in and ETH comes out, the P&L it shows you is fiction. The real numbers require tracing cost basis through every protocol interaction, recognizing income at the right moments, and maintaining separate lot queues for each wallet and chain.
The complexity is not optional. It is what DeFi does to your cost basis. The question is whether you track it as it happens or try to reconstruct it later.
(For a broader look at how to track DeFi positions, see our DeFi tracking guide. For the mechanics of how transfers affect cost basis, see our transfer guide. For a guide on choosing a tracker that handles this correctly, see our buyer's guide. For a guide on how airdropped tokens are taxed and how income recognition creates new cost basis lots at receipt, see our airdrop tax guide. For a breakdown of how a protocol exploit affects your cost basis and what records you need to claim a loss, see our DeFi hack guide.)
Disclaimer: This article is for informational purposes only and does not constitute legal, tax, financial, or investment advice. Cryptocurrency tax rules are complex, depend on your specific situation, and are subject to frequent regulatory changes. The tax treatment of certain DeFi interactions (particularly liquid staking token exchanges and cross-chain bridges) remains unsettled, and different tax professionals may take different positions. Consult a qualified professional for advice on your individual circumstances.