A crypto swap is a direct exchange of one digital asset for another, carried out through a smart contract in a single on-chain transaction instead of a sell-then-buy sequence on a traditional exchange. You control your funds the whole time, no centralized intermediary matches you with a counterparty, and the entire trade settles on the blockchain. One consequence trips up almost every new user: the IRS treats each swap as a taxable disposal, even though no dollars ever move.
How a Swap Executes On-Chain
Most swaps happen on decentralized exchanges like Uniswap, SushiSwap, or PancakeSwap. These platforms don’t match buyers with sellers. They use an Automated Market Maker, which replaces the order book with a formula and pools of tokens that anyone can trade against.
The most common formula is the constant product formula, written x × y = k, where x and y are the quantities of the two tokens in a pool and k is a fixed constant. When you swap ETH for another token, you deposit ETH into the pool and withdraw the other token. That changes the ratio, and the ratio sets the price. No human quotes you a rate.
The tokens sitting in those pools come from liquidity providers, users who deposit equal dollar amounts of both tokens and earn a cut of the fees every time someone trades against the pool. The deeper the pool, the smoother your swap executes, which is why major pairs price better than obscure ones.
The Approval Step
Before your first swap of a given token on most platforms, you have to send two transactions. The first is an approval that grants the swap contract permission to move that token from your wallet. The second is the swap itself. The approval has its own gas fee and is easy to miss, and by default many contracts request unlimited spending permission. That permission persists until you revoke it.
What Determines the Price You Actually Get
Slippage
Slippage is the gap between the price you expected and the price you got. Every swap shifts the token ratio in the pool, which moves the price. Small trades in deep pools barely register. Large trades in shallow pools can move the price sharply. Swap interfaces let you set a maximum slippage tolerance; if the price moves past that threshold while your transaction is pending, the swap fails rather than filling at a worse rate. Set it too tight and transactions fail. Set it too loose and you invite worse execution.
Gas Fees
Every swap pays a network fee to the validators who process the transaction. On Ethereum’s main network, a token swap can cost anywhere from a few dollars to $30 or more during congestion. That fee is the same whether you swap $50 or $50,000, which makes small trades painful on the main chain.
Layer 2 networks like Arbitrum and Optimism bundle transactions and settle them on Ethereum as a batch, dropping typical swap fees to somewhere between $0.01 and $0.30. If you swap often or in small sizes, doing it on a Layer 2 saves real money over time.
MEV and Sandwich Attacks
When you submit a swap, it sits in a public waiting area called the mempool before confirmation. Bots scan the mempool for profitable pending trades. In a sandwich attack, a bot places a buy just before your swap (pushing the price up), lets your trade execute at the inflated price, and sells right after, pocketing the difference.
You have a few defenses. Some wallets route your transaction through a private mempool so bots can’t see it. Intent-based protocols let you submit a swap request to a private network of fillers who compete for your order rather than front-running it. A tight slippage tolerance also caps what a sandwich can extract, at the cost of more failed transactions. For a meaningful swap on Ethereum mainnet, some form of MEV protection is worth the extra click.
Common Types of Swaps
A spot swap is the default: Token A for Token B at the current market price, settled as soon as the block confirms. That’s what happens on a standard DEX.
A cross-chain swap moves assets from one blockchain to another, usually through a bridge protocol that locks your token on its native chain and mints a wrapped version on the destination chain. Bridges have been among the most exploited pieces of infrastructure in crypto, with five of the largest bridge hacks between 2021 and 2022 accounting for over $2.3 billion in losses, including $624 million on Ronin and $326 million on Wormhole. If you bridge, keep your exposure limited and stick to well-established protocols.
An atomic swap is a trustless alternative for cross-chain trades. Two parties exchange tokens directly using Hash Time-Locked Contracts, which use cryptographic proofs and a countdown so that either both sides complete or neither does. No intermediary holds funds. The tradeoff is that both blockchains must support compatible scripting, so the pairs available are limited, and the process is slower and more technical than using a bridge.
A DEX aggregator scans dozens of exchanges and liquidity sources at once and routes your trade for the best net price, sometimes splitting it across multiple pools in a single transaction. For any swap of meaningful size, an aggregator generally beats going to a single DEX directly.
Security Risks Before You Swap
Smart contracts can contain bugs. The most damaging categories include reentrancy attacks, oracle manipulation where an attacker feeds false price data to the contract, and logic flaws that let attackers drain pool funds. Protocols holding hundreds of millions of dollars have been exploited through exactly these weaknesses. Using well-audited protocols with long track records reduces exposure, but nothing is risk-free.
Token approvals deserve their own caution. If a contract you approved months ago is later exploited, an attacker can drain your entire balance of that token without you signing anything new. Tools like Revoke.cash, or the approval manager built into your wallet, let you review and cancel old permissions. When possible, approve only the amount you need for the current swap rather than granting unlimited access.
How Crypto Swaps Are Taxed
The IRS treats digital assets as property, not currency. Because of that classification, every crypto-to-crypto swap is a taxable event, even though no dollars change hands.
Capital Gains and Losses
When you swap Token A for Token B, you are disposing of Token A. Subtract your cost basis in Token A from the fair market value of Token B at the moment of the swap. If the result is positive, you have a capital gain. If it’s negative, you have a capital loss.
How long you held Token A sets the rate. Held one year or less, the gain is short-term and taxed at your ordinary income rate. Held more than a year, it qualifies for long-term capital gains rates, which for 2026 are 0%, 15%, or 20% depending on taxable income:
- 0% for taxable income up to $49,450 (single) or $98,900 (married filing jointly)
- 15% for income from those thresholds up to $545,500 (single) or $613,700 (joint)
- 20% above those amounts
The gap between short- and long-term rates is large. Someone in the 32% ordinary bracket who realizes a short-term gain pays nearly double what they’d owe on the same gain held past the one-year mark.
Cost Basis and Recordkeeping
Your cost basis is what you paid for the token, including gas fees and commissions at the time of purchase. When you swap Token A for Token B, the fair market value of Token A at the moment of the swap becomes your new cost basis in Token B. Every subsequent swap resets the basis again. After a handful of swaps, the math gets messy fast, and crypto tax software that connects to your wallets and exchange accounts is close to essential if you trade with any frequency.
What You File
Report each swap on IRS Form 8949, with totals carried to Schedule D of your Form 1040. Every swap is a separate line item. The 1040 also has a digital assets question on its front page; check “Yes” if you sold, exchanged, or otherwise disposed of any digital assets during the year.
Like-Kind Exchange Doesn’t Apply
Some holders have argued that swapping one cryptocurrency for another should qualify as a tax-free like-kind exchange under Section 1031. That argument doesn’t work. Since the Tax Cuts and Jobs Act of 2017, Section 1031 applies only to real property. Any crypto swap completed on or after January 1, 2018 is fully taxable.
The Wash Sale Rule Doesn’t Apply (For Now)
The wash sale rule prevents stock and securities traders from claiming a loss if they repurchase the same asset within 30 days. As of 2026, it does not apply to cryptocurrency, because the IRS classifies crypto as property rather than stock or securities. You can sell a token at a loss, immediately repurchase it, and still claim the loss. Legislative proposals have aimed at closing this gap, and it could change, but the treatment stands for now.
If You Swap Staking or Mining Rewards
Tokens received through staking, mining, or liquidity pool rewards were taxed as ordinary income at the moment you gained control over them. That fair market value became both taxable income (reported on Schedule 1 as other income) and your cost basis in those tokens. When you later swap them, any change in value since receipt is a separate capital gain or loss on Form 8949 and Schedule D. The two events are reported in different places, and keeping them straight matters.
1099-DA Reporting Timeline
New IRS rules require custodial crypto brokers, including centralized exchanges and hosted wallet providers, to report your transactions on Form 1099-DA. Gross proceeds reporting began for transactions on or after January 1, 2025, and cost basis reporting begins for transactions on or after January 1, 2026. The rules do not yet cover decentralized exchanges or non-custodial platforms. If you swap through a DEX, no 1099-DA will arrive, but you are still responsible for reporting every taxable transaction yourself.
A Note on Regulation
The regulatory picture for decentralized swap platforms is still unsettled. FinCEN’s 2019 guidance on convertible virtual currencies treats money transmitter status as a facts-and-circumstances question rather than a centralized-versus-decentralized one, meaning a DEX and its operators can fall under money transmitter rules if the platform acts as an intermediary. Some jurisdictions have started requiring DEX front-ends to implement compliance procedures, and several prominent interfaces have begun geo-blocking users from restricted countries. The direction of travel is toward more regulation, and what’s permissible today on a given platform may require additional compliance steps in the near future.