DeFi Taxes Explained: Swaps, LPs, Yield Farming & More
A comprehensive guide to how decentralized finance activities are taxed — covering DEX swaps, liquidity pools, yield farming, lending, borrowing, and bridges.
Why DeFi Makes Taxes Complicated
Decentralized finance created an entirely new universe of financial activities — and with it, an entirely new universe of taxable events. Unlike centralized exchanges that provide downloadable transaction histories, DeFi protocols operate on-chain without account-based records. There's no 1099 form from Uniswap, no annual statement from Aave.
Making matters worse, a single DeFi transaction can involve multiple taxable events in a single blockchain transaction. Depositing into a liquidity pool might simultaneously involve a swap, a deposit, and the receipt of LP tokens — each potentially taxable.
This guide walks through every major DeFi activity and its tax implications. While specific rules vary by country, the general principles apply broadly.
DEX Swaps (Token Trades)
Using a decentralized exchange like Uniswap, SushiSwap, Curve, Jupiter, or any other DEX to swap one token for another is a taxable disposal — exactly the same as selling on a centralized exchange.
How It Works Tax-Wise
When you swap 1 ETH for 2,000 USDC on Uniswap:
- You are selling 1 ETH (disposal)
- You are buying 2,000 USDC (acquisition)
- Your gain or loss on the ETH is: 2,000 USDC (fair market value received) minus your cost basis in that 1 ETH
- The gas fee you paid for the swap can typically be added to your cost basis or deducted as a transaction cost
Multi-Hop Swaps
DEX aggregators like 1inch or Jupiter often route trades through multiple pools. If you swap Token A for Token B, but the route goes A → WETH → USDC → B, each intermediate swap may technically be a separate taxable event. In practice, most tax software treats the end-to-end swap as a single trade (A → B), which is the reasonable approach and unlikely to be challenged.
Gas Fees on Swaps
Gas fees (or transaction fees on Solana, etc.) paid to execute a swap are generally treated as part of the transaction cost. This means:
- Gas paid when buying crypto adds to your cost basis
- Gas paid when selling crypto reduces your proceeds (lowering your gain)
- Gas paid on failed transactions may be deductible as a loss in some jurisdictions, though this is a gray area
Liquidity Pools
Providing liquidity to a pool on Uniswap, Curve, Raydium, or any AMM involves multiple potential taxable events at each stage.
Depositing into a Pool
When you deposit tokens into a liquidity pool, you receive LP tokens in return. The tax treatment depends on your jurisdiction and how the deposit is structured:
- Conservative view (most common): Depositing tokens into a pool is a disposal of those tokens and acquisition of LP tokens. You realize gains or losses on the deposited tokens at their market value at the time of deposit.
- Alternative view: The deposit is a non-taxable event similar to depositing into a savings account. You're just changing the form of your existing asset. This view is less common but has some support in certain jurisdictions.
For equal-value deposits (e.g., 50/50 ETH/USDC), some users need to first swap to get the right ratio — that swap itself is taxable.
Earning Fees as an LP
As a liquidity provider, you earn a share of the trading fees. These fees accrue automatically in most AMM designs (Uniswap V2/V3, Curve, etc.):
- Uniswap V2-style pools: Fees are reinvested into the pool, increasing the value of your LP tokens. The tax event occurs when you withdraw — your LP tokens are worth more than what you put in.
- Uniswap V3 concentrated liquidity: Fees accumulate separately and must be claimed. Claiming fees is an income event at the fair market value when claimed.
- Protocol incentive tokens: Many pools also distribute governance tokens (e.g., UNI, CRV, CAKE) as additional rewards. These are income at the market value when received.
Impermanent Loss
Impermanent loss (IL) occurs when the price ratio of your deposited tokens changes, resulting in less total value than simply holding. The tax treatment is murky:
- IL is not realized until you withdraw from the pool
- Upon withdrawal, the difference between your deposit value and withdrawal value may constitute a capital loss
- Most tax authorities have not issued specific guidance on IL
- The conservative approach: calculate your gain or loss on withdrawal based on the cost basis of the LP tokens vs. the value of the tokens received
Withdrawing from a Pool
Withdrawing liquidity means exchanging your LP tokens for the underlying pool tokens. This is generally treated as:
- A disposal of your LP tokens
- The proceeds are the fair market value of the tokens you receive
- Your gain or loss is: value of tokens received minus cost basis of your LP tokens
Yield Farming
Yield farming typically involves staking LP tokens or other assets in a "farm" or "vault" to earn additional rewards, usually in the form of governance tokens.
Receiving Farm Rewards
Rewards received from yield farming are generally treated as ordinary income at the fair market value when you gain control of them (i.e., when they become claimable or auto-harvested). Common reward types:
- Governance tokens (CAKE, CRV, JOE, etc.) — income when claimed
- Auto-compounding rewards (vaults like Yearn, Beefy) — income is recognized as the vault token increases in value, or at withdrawal
- Rebasing tokens (OHM-style) — each rebase that increases your token count is potentially an income event
Auto-Compounding Vaults
Vaults that automatically reinvest rewards (Yearn, Beefy, Convex) present a specific challenge: rewards are harvested and reinvested frequently (sometimes multiple times per day). Two approaches:
- Track each harvest: Treat each auto-compound as receiving income and immediately reinvesting it. Accurate but extremely complex.
- Track at deposit/withdrawal: Treat the vault deposit as an investment; the difference between deposit value and withdrawal value is your gain. Simpler, but may not be strictly correct for income categorization.
Most crypto tax software that supports DeFi will attempt to track the individual harvests. This is one area where having good software is practically mandatory.
Lending and Borrowing
Lending (Aave, Compound, etc.)
When you deposit crypto into a lending protocol:
- Depositing: You receive receipt tokens (aTokens, cTokens). Whether this is a taxable swap depends on the jurisdiction and the specific token mechanics.
- Earning interest: Interest accrues automatically. This is income — either when it accrues (aTokens grow in balance) or when you claim it.
- Withdrawing: You swap your receipt tokens back for the underlying asset plus interest. The interest portion is income; any change in the underlying asset's value since deposit may trigger capital gains.
Borrowing
Taking out a loan against your crypto collateral is generally not a taxable event — you haven't disposed of your collateral. However:
- Interest payments are generally not deductible for personal investors (may be deductible for businesses)
- Repaying a loan with crypto you bought at a different price triggers a capital gain or loss on the repayment tokens
- Liquidation — if your collateral is liquidated, it is treated as a forced sale at market price, triggering capital gains on the liquidated amount
Flash Loans
Flash loans (borrowed and repaid within a single transaction) present an unusual case. Since they're atomic, the tax implications depend entirely on what you did with the borrowed funds within the transaction. If you used a flash loan for arbitrage, the profit is taxable; the flash loan itself is just the mechanism.
Wrapping, Bridging, and L2s
Wrapping (ETH → WETH, BTC → WBTC)
Whether wrapping a token is a taxable event is one of the most debated questions in crypto tax:
- Conservative view: Wrapping is a disposal of ETH and acquisition of WETH — a taxable swap
- Practical view: Wrapping is a like-kind exchange or a non-taxable conversion — WETH is essentially a receipt for ETH with the same economic value
The IRS has not issued specific guidance. Most tax professionals recommend the conservative approach unless the amounts involved make it worth seeking a formal opinion. Many crypto tax tools let you choose whether to treat wraps as taxable.
Bridging (Moving Assets Cross-Chain)
Bridging tokens from one blockchain to another (Ethereum to Arbitrum, Solana to Polygon, etc.) raises the same question as wrapping. If the bridge gives you a synthetic/wrapped version of the asset on the destination chain, the conservative view treats it as a swap. If the bridge is a "lock and mint" mechanism, some argue it's more like a transfer.
Regardless of the tax treatment of the bridge itself, make sure your tax software can track the asset across chains. Otherwise, it may look like you sold on one chain and bought on another, creating phantom gains.
L2 Transfers (Ethereum → Arbitrum, Optimism, Base)
Moving assets to an L2 rollup is generally treated as a wallet-to-wallet transfer (non-taxable), since you're moving native assets within the same ecosystem. However, some L2 interactions involve bridging wrapped tokens, which falls into the wrapping gray area.
Stablecoins and DeFi
Stablecoins (USDC, USDT, DAI) seem like they should be tax-neutral since their value doesn't change. But there are subtleties:
- Swapping volatile crypto for stablecoins is fully taxable — selling BTC for USDC is no different from selling BTC for USD
- Earning stablecoin yield (Aave USDC lending, etc.) is income, even though the principal value doesn't change
- Stablecoins can depeg — if you buy USDC at $1.00 and sell at $0.98, you technically have a capital loss. This happened with UST/LUNA (massive losses) and even briefly with USDC in March 2023
- Swapping between stablecoins (USDC → DAI) is technically taxable, but with near-zero gain/loss. Still worth tracking for completeness.
NFTs and DeFi Intersections
Some DeFi protocols use NFTs to represent positions:
- Uniswap V3 LP positions are represented as NFTs. Minting one when you provide liquidity and burning it when you withdraw are the taxable events, not the NFT itself.
- NFT-collateralized lending (NFTfi, BendDAO): Using an NFT as loan collateral is generally not taxable, but liquidation of the NFT is a disposal.
- NFT fractionalization: Breaking an NFT into fungible tokens is likely a disposal of the NFT.
Record-Keeping for DeFi
DeFi transactions live on-chain, which is both a blessing and a curse. The data is all there — but you need to capture it correctly:
- Track every wallet address you use. Even if you only used a hot wallet once for a quick swap, include it.
- Record the blockchain and protocol for each interaction. "Sold some tokens" is not sufficient; "Swapped 1 ETH for 2,000 USDC on Uniswap V3 (Ethereum mainnet)" is.
- Note the gas fees for each transaction — these are part of your cost basis.
- Keep track of airdrop eligibility snapshots — the snapshot date may determine when income was "received."
- Use software that reads blockchain data directly. Manual tracking of DeFi is almost impossible at any meaningful scale.
Best Crypto Tax Software for DeFi Users
Not all crypto tax tools handle DeFi equally. The best ones for DeFi users can read on-chain transactions directly and understand protocol-specific mechanics:
| Tool | Blockchains | DeFi Strength | Best For |
|---|---|---|---|
| Koinly | 170+ | 100+ DeFi protocols, auto-categorization | All-around DeFi users |
| Crypto Tax Calculator | 200+ | Best raw blockchain coverage, deep DeFi parsing | Multi-chain DeFi power users |
| CoinTracker | 80+ | Good DeFi support, Coinbase integration | DeFi + Coinbase users |
| CoinTracking | 50+ | Detailed analytics, requires more manual work | Data-focused traders |
Use our comparison tool to find the right one for your specific DeFi needs.
Frequently Asked Questions
Do I owe taxes if I just provided liquidity and didn't sell?
Potentially yes. Depositing tokens into an LP may be treated as a disposal in some jurisdictions. Additionally, any rewards you claimed (trading fees, governance tokens) are income when received. The conservative approach is to treat LP deposits as taxable events.
What if I interacted with a DeFi protocol that no longer exists?
On-chain data is permanent. Even if the protocol's website is down, your transactions are still on the blockchain. Crypto tax software reads directly from the blockchain, so it can still find and categorize your transactions. However, if the protocol was obscure, you may need to manually categorize some transactions.
Are governance votes or token approvals taxable?
No. Voting with governance tokens and approving token spending are not taxable events — they don't involve a disposal of assets. However, the gas fees paid for these transactions are a cost that may or may not be deductible depending on your jurisdiction.
What about DeFi on Solana, Avalanche, or other chains?
The tax principles are exactly the same regardless of which blockchain you're using. A swap on Jupiter (Solana) is treated the same as a swap on Uniswap (Ethereum). The main difference is software support — make sure your chosen tax tool supports the chains you use.
Disclaimer: This guide is for informational purposes only and does not constitute tax, legal, or financial advice. Cryptocurrency tax rules change frequently and vary by jurisdiction. Always consult a qualified tax professional for advice specific to your situation.