You line up a swap, the screen quotes a clean number of tokens, you confirm — and the amount that lands in your wallet is smaller than the quote. Nothing was stolen; nothing broke. You met slippage, the gap between the price you saw and the price you got — the most misunderstood part of trading on a decentralized exchange.
The takeaway up front: a swap is not a fixed-price checkout. The quote is an estimate of the moment, and by the time your transaction confirms the price can have moved, a fee was taken, and your own order may have pushed the price against you. Slippage tolerance controls how much of that movement you accept — too tight and your swap fails, too loose and you can be deliberately squeezed.
Not financial advice. This is general educational content — not personalized investment advice or a recommendation to buy, sell, or hold any asset. Cryptocurrency is a volatile, speculative asset class where losses can be total and transactions are typically irreversible. Consider speaking with a licensed professional about your own situation.
What actually happens when you swap
On a decentralized exchange you are not matched against another trader. You trade against a liquidity pool — a smart contract holding a reserve of two tokens, say ETH and a stablecoin. When you swap one for the other, you add to one side and remove from the other, and the contract recalculates the price from the new balance.
The consequence most newcomers never hear: the price moves as your trade executes. The bigger your swap relative to the pool, the more you shift the balance and the worse the price gets — a small trade barely nudges a deep pool, while a large trade in a shallow pool can move the price several percent against you in a single transaction. A centralized exchange hides this behind an order book and a "buy" button, trading custody and fees for the convenience, as the guide to how to choose a crypto exchange explains. On a DEX the pool math is exposed — and understanding it is how you stop bleeding value.
Slippage vs. price impact — they are not the same
People use "slippage" for two different things, and confusing them leads to bad settings:
- Price impact is the cost your own trade causes by moving the pool. It is knowable before you confirm — a good interface shows it as a percentage on the quote — and high impact means the pool is too shallow for your size.
- Slippage is the price change between the moment you sign and the moment the transaction confirms, caused by other trades landing in the pool before yours. It is unpredictable — you cannot know what else will execute in those seconds.
Slippage tolerance is your guardrail against the second one. You set a percentage — say 0.5% — and the swap completes only if the final price is within that band of the quote. If the market moves past your tolerance first, the swap reverts — it fails on purpose to protect you from a worse-than-agreed fill, which is a feature, not a bug.
Why you receive fewer tokens than the quote
Three separate costs stack into the gap between the quote and what you receive: the pool's swap fee (a small cut paid to liquidity providers on every trade, baked into the price), price impact (covered above — your own order moved the pool against you), and network gas (a separate fee to process the transaction, which you pay even if the swap fails and which can dwarf a small swap on a busy chain).
None of these is a scam — they are the standing costs of swapping on-chain. You can shrink them by trading deeper pools, swapping when the network is quieter, and sizing trades sensibly for the gas.
The sandwich attack — when loose slippage costs you
In one case slippage is adversarial, not just mechanical. Because pending transactions are publicly visible before they confirm, a bot can spot your swap, jump in front to push the price up, let your trade execute at that worse price, then sell behind you — your swap is the filling, the bot's two trades the bread. This is a sandwich attack, a form of front-running.
The bot can only profit up to the slippage you allowed. Set tolerance to 20% on a large swap and you have invited the squeeze. The defenses are practical:
- Keep slippage as tight as the trade allows. Low tolerance caps how much a sandwich can take; raise it only as much as a volatile or illiquid token genuinely needs.
- Split very large swaps into smaller pieces so no single trade is a fat, obvious target.
- Favor deep, liquid pools, where moving the price enough to profit costs the attacker more than it is worth.
The trade-off is real: tighter slippage means more failed, gas-charging swaps on volatile tokens. You are balancing that friction against squeeze risk.
How to set slippage without guessing
There is no universal number, but there is a method — match the setting to the token, then verify:
- Read the quote's price impact first. If a normal-sized swap already shows a large impact, the pool is too shallow — shrink the trade rather than cranking slippage to force it through.
- Start tight on liquid pairs. For major, deeply traded tokens, a fraction of a percent is often enough, and a failed swap here is cheap insurance against a bad fill.
- Loosen deliberately for thin or volatile tokens. A higher tolerance is sometimes the only way a low-liquidity swap completes, but it widens the door for both natural slippage and a sandwich — and a token that demands very high slippage just to trade can signal transfer taxes or restrictions worth investigating.
- Run a small test swap. Trade a tiny amount, confirm what lands and what gas cost, then repeat at full size. The on-chain test is final-proof in a way no quote is.
FAQ
Why did my crypto swap fail but still charge a gas fee?
A swap reverts when the price moves outside your slippage tolerance before it confirms, cancelling the trade to protect you from a worse fill. The network still attempted it, so the gas fee is consumed either way. Repeated failures usually mean your slippage was too tight for the token's volatility, or the network was congested.
What slippage tolerance should I use?
There is no universal number — it depends on the pool's liquidity and the token's volatility. Deep, heavily traded pairs often complete with a fraction of a percent, while thin or volatile tokens may need more. Every extra point widens the room for natural slippage and a sandwich, so start tight, loosen only as much as the token requires, and test small.
Is slippage the same as a fee?
No. A fee is a fixed, known cost — the pool's swap fee and the network's gas. Slippage is the variable price change between quoting and confirming, driven by other trades hitting the same pool. You can read fees in advance, while slippage is bounded only by the tolerance you set.
How do I avoid a sandwich attack?
Keep slippage as low as the trade allows, since a sandwich bot can only profit up to the slippage you permit. Trade in deep, liquid pools where moving the price is expensive for an attacker, and break very large orders into smaller pieces. None of this is a guarantee, but it removes the easy profit that makes you worth squeezing.
Why do larger swaps get a worse price?
Because a decentralized swap trades against a liquidity pool, and your order shifts its balance as it executes — the bigger your trade relative to the pool, the worse your average price. This is price impact, separate from slippage, and the fix is deeper pools, smaller trades, or both.
Take the next step
Swapping on-chain is a trade against a pool whose price moves with every order, yours included. Before your next swap, read the price impact on the quote, set a slippage tolerance that matches the token's liquidity, keep it tight to deny sandwich bots an easy meal, and prove it with a small test trade. Get those habits right and the gap between the quote and what you receive becomes a number you control, not a mystery. Keep learning the practical mechanics of markets — crypto and beyond — at TopInvestors.