How to Swap Tokens Without Getting Sandwiched
By Emily Carter
Policy Correspondent · November 22, 2026 · 9 min read
Published November 22, 2026 · Reviewed to our editorial standards. This article is informational and not financial advice.

You submit a swap, it fills two per cent worse than quoted, and you assume the market moved. Sometimes it did. Often you were sandwiched: someone saw your pending transaction, bought ahead of it, let your trade push the price up, and sold into it.
The attack requires three conditions, and you control two of them.
How the attack works
Transactions wait in a public queue before being included in a block. Anyone can read that queue, so a searcher sees your swap, its size, and the slippage tolerance you set — which tells them precisely how much they can move the price before your trade fails.
They buy first, your trade executes at the worse price they created, and they sell immediately after. Their profit is your loss, and the whole sequence lands in the same block.
Protection one: set slippage tolerance properly
Your tolerance is the maximum adverse move you will accept, and it is also the attacker's budget. Set it to 5% and you have authorised anyone to extract up to 5%; set it to 0.5% and there is far less to take.
The trap is that a tolerance set too tight causes failed transactions, which cost gas and are annoying, so people raise it until failures stop. That is exactly backwards — a failed swap costs a network fee, while a sandwiched one costs a percentage of the trade.
For deep stable pairs, 0.1% to 0.3% is workable. For volatile pairs, 0.5% to 1%. Anything above that should be a deliberate decision about a specific illiquid token, not a default you stopped thinking about.
Protection two: do not broadcast publicly
The most effective single change. Private transaction relays send your swap directly to block builders instead of the public queue, so searchers never see it and cannot trade around it.
Several wallets support this with a setting or an alternative endpoint, and it usually costs nothing. If your wallet offers a protected transaction mode, turn it on and leave it on — this is the rare security measure with no downside.
Protection three: use an auction fill mode
Some aggregators fill orders through a competitive auction rather than executing them directly against pools. Resolvers bid to fill your order, and because the trade never sits in the public queue as an executable swap, the sandwich surface disappears.
1inch's Fusion mode works this way, and the cost is embedded in the resolver's spread rather than charged separately. For anyone who has watched a swap fill several per cent worse than quoted, that trade is worth far more than a basis point of routing improvement.
Protection four: size the order to the pool
Sandwiching only pays when your trade moves the price enough to be worth attacking. A small order in a deep pool is not a target, because there is nothing to extract.
Before a large swap, check the pool's depth and estimate your price impact — every good interface shows it. If the impact is above about 1%, split the order or route through an aggregator that spreads it across pools.
What does not protect you
- Higher gas fees. Attackers pay whatever it takes; you are bidding against someone with a guaranteed profit.
- Trading at quiet hours. Searchers are automated and do not sleep.
- Using a different front end onto the same public pools, since the queue is shared.
- Small slippage tolerances alone on a very large order, which fails rather than protecting.
A working default
Turn on private transactions in your wallet. Use an aggregator with an auction fill mode for anything meaningful. Keep slippage at 0.5% or below on liquid pairs. Check price impact before confirming, and split anything above 1%.
That takes one afternoon to set up and applies to every swap thereafter. Our best DEXs table records which venues and aggregators offer MEV protection by default, and what is MEV covers where the extracted value actually goes.
Where sandwiching hurts most
New token launches, thin pools and volatile moments — precisely where people set wide slippage tolerances because trades keep failing. That combination is the most profitable target on-chain, and it is entirely self-selected by the people being hit.
If you are trading a newly launched token in a shallow pool, assume every transaction is being watched by automated systems for which this is a full-time business. Use a private relay, accept the failed transactions, and size down.
Chains where this matters less
The attack needs a public waiting queue and time to act. Chains with very fast blocks compress that window, and some layer twos currently order transactions through a single operator rather than an open market, which removes the searcher competition entirely.
That is not the same as being safe — it means the ordering power sits with the operator rather than in a public market — but it does mean the classic sandwich is rarer there today. Do not carry assumptions between chains; check what your wallet is actually doing on the one you are using.
One thing worth keeping in perspective
Not every bad fill is an attack. Volatile markets move between quote and execution, and a swap in a thin pool has genuine price impact that nobody extracted from you. Blaming MEV for ordinary slippage leads to the wrong fix.
The way to tell is to look at the transaction on a block explorer: a sandwich appears as trades in the same pool immediately before and after yours, from the same address. If they are not there, the market simply moved, and the answer is order sizing rather than privacy.
Frequently asked questions
What is a sandwich attack?+
A searcher sees your pending swap, buys ahead of it to push the price against you, lets your trade execute at the worse price, and sells immediately after. Their profit comes directly from your fill.
What slippage tolerance should I set?+
0.1% to 0.3% on deep stable pairs and 0.5% to 1% on volatile ones. Your tolerance is also the attacker's maximum extraction, so a wide setting is an invitation.
How do I stop MEV bots seeing my transaction?+
Use a private transaction relay, which many wallets support as a setting. It sends the swap directly to block builders instead of the public queue, so searchers never see it.
Does paying more gas prevent sandwiching?+
No. Attackers will outbid you because their profit is nearly guaranteed. Privacy and order sizing work; fee bidding does not.
Written by
Emily CarterFormer regulatory analyst · J.D.
Emily Carter is a legal and regulatory writer specializing in cryptocurrency, blockchain policy, and digital asset compliance. Before joining CRYPTO·COINBEAT, she worked as a regulatory analyst in the United States, tracking developments in federal financial legislation, anti-money laundering (AML) requirements, and emerging policies shaping the digital asset industry. She earned her Juris Doctor (J.D.) degree and combines legal expertise with a talent for translating complex regulatory topics into clear, accessible language. Her work focuses on cryptocurrency taxation, DeFi regulation, exchange compliance, stablecoins, and the evolving role of U.S. agencies in overseeing digital assets. At CRYPTO·COINBEAT, Emily writes educational guides and policy explainers designed for both newcomers and experienced crypto users. She is committed to helping readers understand how regulatory changes affect investors, businesses, and the broader blockchain ecosystem.
Keep Reading

Crypto Lending and Borrowing in DeFi Explained
DeFi lending markets let anyone earn interest or borrow against crypto, governed entirely by code. Here is how collateral, rates, and liquidations actually work.
David Turner · May 2, 2026→

What Is Impermanent Loss in DeFi?
Impermanent loss quietly erodes the value of liquidity positions when token prices move. Here is why it happens, how big it gets, and when fees offset it.
Maria Fernandez · May 9, 2026→

Yield Farming and Liquidity Mining Explained
Yield farming chases returns by moving crypto between DeFi protocols. We break down where the yield comes from, how APY can mislead, and the risks behind big numbers.
David Turner · May 23, 2026→