A crypto swap is a direct exchange of one digital asset for another, carried out by a smart contract on the blockchain instead of through a traditional exchange’s order book. You put one token in, another comes out, and the whole trade settles in a single on-chain transaction. No intermediary custodies your funds along the way, and no human sets the price.
That structure is what makes swaps useful, and it’s also what makes them different from anything you’d do on a stock brokerage. The mechanics, the fees, the risks, and the tax treatment all follow from it.
How a Swap Actually Executes
Most swaps happen on decentralized exchanges such as Uniswap, SushiSwap, or PancakeSwap. These platforms don’t match individual buyers to individual sellers. They use an Automated Market Maker, which replaces the order book with a formula and a pool of tokens that anyone can trade against.
The most common formula is the constant product rule, written x × y = k, where x and y are the quantities of the two tokens in the pool and k is a fixed constant. When you swap ETH for another token, you deposit ETH into the pool and pull the other token out. That changes the ratio between the two, which automatically changes the price. The formula, not a market maker, decides your rate.
The tokens sitting in those pools come from users called liquidity providers, who deposit equal dollar amounts of both tokens and earn a share of the swap fees in return. The deeper the pool, the smoother your swap will execute, which is why popular pairs give better prices than obscure ones.
The Approval Step
Your first swap with any given token on any given platform involves two transactions, not one. The first is an approval that grants the swap contract permission to move that token out of your wallet. The second is the swap itself. The approval has its own gas fee and is easy to breeze past, but many platforms request unlimited spending permission by default. That’s a security exposure you carry indefinitely unless you revoke it. Some wallets and protocols now offer temporary or capped approvals; where that option exists, use it.
What Determines the Price You Actually Get
Slippage
Slippage is the gap between the price you expected and the price your trade actually filled at. Every swap shifts the ratio in the pool, which shifts the price. A small trade in a deep pool barely moves things. A large trade in a shallow pool can move them a lot. Swap interfaces let you set a maximum slippage tolerance; if the price drifts past that threshold while your transaction is pending, the swap fails instead of executing at a bad number. Set it too tight and your transactions fail repeatedly. Set it too loose and you invite worse execution, plus the sandwich attacks described below.
Gas Fees
Every swap pays a network fee to the validators who confirm the transaction. On Ethereum’s main network, a token swap can cost anywhere from a few dollars to $30 or more when the network is congested. That fee is flat with respect to trade size, so a $50 swap and a $50,000 swap pay roughly the same gas. Small swaps on Ethereum mainnet can lose most of their value to fees.
Layer 2 networks like Arbitrum and Optimism batch many transactions and settle them to Ethereum together, which brings the per-swap cost down to roughly $0.01 to $0.30. For frequent or smaller trades, running your swaps on a Layer 2 rather than mainnet is the single biggest cost savings available.
MEV and Sandwich Attacks
When you submit a swap, it sits in a public queue called the mempool before confirmation. Bots watch that queue. In a sandwich attack, a bot sees your pending swap, buys the same token just before yours executes (pushing the price up), lets your trade fill at the inflated price, and sells immediately after (pocketing the difference). You overpay without ever knowing why.
Three defenses help. Some wallets route your transaction through a private mempool so bots can’t see it. Intent-based protocols send your swap to a private network of fillers who compete on price rather than extracting from you. And a tight slippage tolerance caps how much a sandwich can take, at the cost of more failed transactions. For any meaningful swap on Ethereum mainnet, some form of MEV protection is worth turning on.
Types of Swaps You’ll Encounter
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 a standard DEX transaction is.
A cross-chain swap moves you between blockchains. If you hold ETH on Ethereum but want a token native to Solana, a cross-chain swap handles the conversion, usually by locking your original token on its home chain and issuing a wrapped equivalent on the destination chain. The mechanism is a bridge, and bridges have been among the most attacked pieces of crypto infrastructure. Five of the largest bridge exploits between 2021 and 2022 caused more than $2.3 billion in losses combined, including the $624 million Ronin hack and the $326 million Wormhole hack. If you use bridges, size your exposure with those numbers in mind and stick to well-established protocols.
Atomic swaps are a trustless alternative for cross-chain trades. Two parties exchange tokens directly using Hash Time-Locked Contracts, which use cryptographic proofs and a timer to guarantee that either both sides settle or neither does. No one custodies funds mid-trade. The downside is that both blockchains must support compatible scripting, so the available pairs are limited, and the process is slower and more technical.
DEX aggregators sit on top of everything else. Instead of checking prices exchange by exchange, an aggregator scans many liquidity sources at once and routes your swap through whatever combination gives the best net price, sometimes splitting a single trade across several pools. For any swap large enough to matter, an aggregator almost always beats going directly to one DEX.
Risks Worth Planning For
Smart Contract Vulnerabilities
Every swap runs through code, and code has bugs. The damaging categories are reentrancy attacks, where a malicious contract calls back into the swap contract before the first call finishes; oracle manipulation, where an attacker feeds false price data; and logic flaws that let an attacker drain pool funds. Protocols with hundreds of millions of dollars on deposit have been exploited through each of these. Well-audited protocols with long track records reduce the risk but never eliminate it.
Old Token Approvals
The approval you granted months ago is still live. If the contract you approved is later exploited, the attacker can drain your entire balance of that token without you signing anything new. Reviewing and revoking stale approvals through tools like Revoke.cash or a wallet’s built-in approval manager is one of the simplest habits that meaningfully reduces your risk. Where the interface offers it, approve only the amount you need for the swap in front of you rather than an unlimited allowance.
A Note on Impermanent Loss
Impermanent loss is a risk for liquidity providers, not for swappers. If you’re only trading through pools rather than supplying them, this doesn’t apply to you. If you decide to provide liquidity, understand that when the price ratio between the two tokens in your pool changes significantly, you can end up with less total value than if you had simply held both tokens.
How the IRS Treats a Swap
The IRS treats digital assets as property, not currency. That classification is the entire ballgame: every crypto-to-crypto swap is a taxable event, even though no dollars ever changed hands.
Capital Gains and the Holding Period
When you swap Token A for Token B, you’ve disposed 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 it’s positive, that’s a capital gain. If it’s negative, a capital loss.
Your holding period on Token A sets the rate. One year or less is a short-term gain, taxed at your ordinary income rate. Longer than one year qualifies for long-term capital gains rates, which for 2026 are:
- 0% on taxable income up to $49,450 for single filers, $98,900 for married filing jointly
- 15% on taxable income from those thresholds up to $545,500 single or $613,700 joint
- 20% on taxable income above those amounts
The gap between short- and long-term treatment is large. Someone in the 32% ordinary bracket who realizes a short-term gain pays close to double what they would on the same gain held past the one-year mark.
Cost Basis Carries Forward
Your basis in a token is what you paid for it, including gas and commissions at the time of purchase. Once you swap Token A for Token B, the fair market value of Token A at the moment of the swap becomes your basis in Token B. Each subsequent swap resets the basis again. After five or six swaps the recordkeeping gets messy, and crypto tax software that pulls from your wallets and exchange accounts becomes close to necessary if you trade with any frequency.
You report each disposition on IRS Form 8949, with totals flowing to Schedule D of Form 1040. Each swap is its own line item. The 1040 itself asks a digital assets question on the front page, and you check “Yes” if you sold, exchanged, or otherwise disposed of any digital asset during the year.
Like-Kind Exchange Doesn’t Apply
Some traders have argued that swapping one cryptocurrency for another should be a tax-free like-kind exchange under Section 1031. It isn’t. 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 that blocks stock traders from claiming a loss if they repurchase the same security within 30 days does not apply to cryptocurrency as of 2026. Because crypto is classified as property rather than stock or securities, you can sell a token at a loss, buy it right back, and still claim the loss. Several legislative proposals have targeted this gap; it could close in a future tax year, but it’s open today.
Tokens From Staking, Mining, or LP Rewards
If you received a token through staking, mining, or liquidity rewards before swapping it, that token was already taxed as ordinary income at its fair market value the moment you gained control over it. That value is both the income you reported and your basis in the token. When you later swap it, any change in value since you received it is a separate capital gain or loss. The income piece goes on Schedule 1; the later swap goes on Form 8949 and Schedule D.
What Brokers Will and Won’t Report
New IRS rules require custodial crypto brokers, including centralized exchanges and hosted wallets, to report transaction details 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. These rules do not yet cover decentralized exchanges or non-custodial platforms. If you swap on a DEX, no 1099-DA is coming, and every taxable transaction is still yours to track and report.
Where the Rules Are Still Moving
FinCEN’s 2019 guidance on convertible virtual currencies states that whether a platform is a money transmitter depends on the facts of what it does, not on whether it calls itself decentralized. A decentralized application that acts as an intermediary in token transfers can fall under money transmitter rules, and so can its operators. Platforms that only provide a peer-to-peer forum generally do not.
Most popular DEX front-ends have operated without identity verification, but that’s shifting. Some jurisdictions have started requiring compliance procedures at the interface layer, and several front-ends now geo-block users in restricted countries. The direction of travel is toward more regulation, not less, so what’s available today on a given platform may require additional steps tomorrow.