Koinly Guide

Crypto Tax Rules for DeFi and Staking: What You Need to Know

If you are using decentralized finance (DeFi) protocols or staking assets to earn yields, you are almost certainly creating taxable events, even though you never touch fiat currency. In most jurisdictions, including the U.S., the IRS treats cryptocurrencies as property, meaning that any disposal—including trades, swaps, and even some transfers into smart contracts—triggers a capital gain or loss. Staking rewards are generally taxed as ordinary income at the fair market value on the day you receive them, and the rules for DeFi can hinge on whether you are lending, providing liquidity, or just holding. While the specific laws vary by country, the core principle is consistent: you need to track your cost basis, the fair market value at receipt, and every transaction that changes your economic position. Below, we break down the practical rules, common pitfalls, and how tools like Koinly can help you stay compliant without drowning in spreadsheets.

The Taxable Events in DeFi You Might Be Ignoring

The biggest mistake new DeFi users make is assuming that because they didn’t “cash out,” no tax is due. That assumption is wrong. Every time you swap one token for another—even if it’s a stablecoin for a governance token—you are disposing of the old token and acquiring a new one. The gain or loss is calculated based on the difference between your original cost basis and the fair market value at the time of the swap.

Swaps and Token-to-Token Trades

When you use a decentralized exchange (DEX) like Uniswap or Curve, the trade is a taxable disposal. The IRS does not distinguish between a DEX and a centralized exchange. You must calculate the gain or loss on the token you gave up, using its value in USD at the exact moment of the trade. This is often the hardest part because DeFi trades can happen in fractions of a second, and you need a timestamped record of the price.

Providing Liquidity and LP Tokens

When you deposit two assets into a liquidity pool, you are making a taxable exchange. You are swapping your tokens for a liquidity provider (LP) token that represents your share of the pool. The moment you receive the LP token, you have disposed of your original assets. When you later remove liquidity, you are disposing of the LP token and receiving a new mix of assets, which is another taxable event. Many tax authorities also treat yield farming rewards—bonus tokens paid in addition to trading fees—as ordinary income when received.

How Staking Rewards Are Taxed (and When)

Staking is conceptually simpler than DeFi but still has a major gray area: the exact timing of income recognition. For proof-of-stake networks like Ethereum, Solana, or Cardano, you are locking up tokens to help secure the network and earn rewards. The IRS has issued guidance stating that staking rewards are income at the time you gain “dominion and control” over them.

Receipt vs. Vesting

If you stake through a centralized exchange like Coinbase or Kraken, you typically receive rewards on a daily or weekly basis, and each reward is a separate income event. If you stake independently using a non-custodial wallet, the same rule applies, but you must be careful about “vesting” schedules. Some protocols lock rewards for a period; you do not owe tax until the rewards are unlocked and available to you.

Cost Basis of Staking Rewards

Once you receive a staking reward, its cost basis becomes its fair market value on the date of receipt. If you later sell or trade that reward, you will have a capital gain or loss based on the difference between that cost basis and the sale price. This means you are effectively double-taxed—once as income and once as capital gain—but that is standard for any asset that appreciates after you earn it.

Lending, Borrowing, and Airdrops: The Edge Cases

DeFi lending platforms like Aave or Compound add another layer of complexity because they involve collateralized loans and interest payments. When you deposit assets as collateral, you are not disposing of them, so that deposit is not a taxable event. However, when you borrow and then sell the borrowed asset, you may owe capital gains tax on that sale. Interest earned on your deposits is ordinary income, and interest paid in crypto is deductible only if you itemize and the loan is for a business or investment purpose.

Airdrops and Forks

If you receive an airdrop of a new token because you held a certain asset or interacted with a protocol, the IRS treats that as ordinary income at the fair market value on the date you can access it. Forks, like the Ethereum/ Ethereum Classic split, are trickier: you may have a zero-cost basis in the new token, but you must still report it as income. Koinly and similar software can help you auto-detect airdrops, but you must verify that the valuation timestamp is correct.

How to Track Everything Without Losing Your Mind

The sheer volume of transactions in DeFi and staking makes manual tracking nearly impossible. You need a system that captures every interaction with a smart contract, including gas fees, which are part of your cost basis. Gas fees paid in ETH or another token are deductible as a cost of acquisition, but only if you properly allocate them to the specific asset you bought or sold.

Using a Crypto Tax Calculator Like Koinly

Koinly is a popular tool that connects to your wallets and exchanges via API or CSV uploads. It automatically imports your transaction history, identifies taxable events, and generates the necessary tax forms (like IRS Form 8949 and Schedule 1). For DeFi, Koinly can often parse complex smart contract interactions, but it is not perfect. You should always review the “unsupported” or “needs review” categories in the software, as some obscure protocols may not be recognized correctly.

Practical Record-Keeping Tips

Here are three habits that will save you during tax season:
  • Timestamp everything: Save your wallet addresses and transaction hashes. You need the exact date and time for each swap, reward, or airdrop.
  • Track cost basis per wallet: Do not mix funds across wallets without clear records. Each wallet is a separate pool for cost-basis purposes in many jurisdictions.
  • Reconcile monthly: Run a monthly report of your portfolio value and compare it to your transaction history. This helps you catch missing transactions before they become a year-end headache.

Comparing DeFi vs. Staking Tax Treatment

To keep the rules clear, here is a quick comparison of how the two activities are generally treated under U.S. tax law:
ActivityTax EventIncome TypeWhen to Report
Swapping tokens on a DEXYes, on each swapCapital gain/lossYear of the swap
Providing liquidityYes, on deposit and withdrawalCapital gain/lossYear of deposit/withdrawal
Receiving staking rewardsYes, on receiptOrdinary incomeYear of receipt
Selling staking rewardsYes, on saleCapital gain/lossYear of sale
Lending collateralNo, on depositN/AN/A
Receiving airdropsYes, on accessOrdinary incomeYear of access

Final Word on Compliance and Penalties

The most important rule is to be consistent. If you use a software tool like Koinly, stick with the same cost-basis method (FIFO, LIFO, or specific identification) across all your wallets and exchanges. Changing methods mid-year can lead to errors and audits. Also, remember that many DeFi protocols are pseudonymous, but tax authorities are increasingly using blockchain analytics to trace activity. Even if you think your transactions are hidden, they are not. The best strategy is to report everything accurately and keep your records for at least seven years, as that is the typical audit window for unreported income. When in doubt, consult a tax professional who understands crypto—the rules are evolving, and a generic accountant may not be equipped to handle your specific situation.