Sandwich Attack
A form of MEV where a bot places one trade just before and one just after a victim's pending swap, profiting from the price impact the victim causes.
Also known as: sandwich bot, MEV sandwich
Last reviewed: 10 June 2026
When a large swap transaction is visible in the public mempool, a sandwich bot detects it and quickly submits a buy order for the same token at a slightly higher gas price (front-running), pushing the price up. The victim's swap then executes at the elevated price. The bot immediately sells (back-running), pocketing the difference at the victim's expense.
The victim receives fewer tokens than expected, with the shortfall going to the bot operator. The attack is named for the victim's transaction being sandwiched between the bot's two transactions. Users transacting on DEXes with low slippage tolerance limit their vulnerability, but setting slippage too low causes transactions to fail.
Using MEV-protected RPC providers, smaller trade sizes, or aggregators that split orders route transactions in ways that reduce sandwich-attack profitability. Understanding slippage settings is one of the most practical defences available to retail DeFi users.