IndexCrypto
Educational only. Not financial, tax or legal advice, and nothing here is a recommendation to buy anything.

Slippage in Crypto: What It Is and How to Manage It

Learn why crypto trade prices differ from quotes, what slippage tolerance authorizes, and how high tolerance invites sandwich attacks.

When you submit a trade on a decentralized exchange, the price you see on the screen is rarely the price at which the trade executes. The difference between the quoted price and the actual execution price is called slippage. Slippage is not a bug or a hidden fee; it is a natural consequence of how automated market makers (AMMs) price assets. Understanding slippage is essential for anyone trading tokens, because it directly affects the cost of every swap, and because the settings you choose can expose you to a type of attack known as a sandwich attack.

What Causes Slippage?

Slippage occurs for two main reasons: liquidity depth and transaction ordering.

Liquidity Depth

An AMM like Uniswap uses a constant product formula to determine prices. For a pool with two tokens, the product of the quantities of both tokens must remain constant. When you buy token A with token B, you remove some A from the pool and add some B. This changes the ratio of the two tokens, which moves the price. The larger your trade relative to the pool’s size, the more the price moves against you. If the pool is deep (contains a lot of liquidity), a small trade will barely move the price. If the pool is shallow, even a modest trade can cause significant price impact. This price impact is the primary component of slippage.

Transaction Ordering

On a blockchain, transactions are not processed in the order they are submitted. Miners or validators choose which transactions to include in a block, and they typically order them by the fees attached. This creates an opportunity for other traders to see your pending transaction in the mempool (the pool of unconfirmed transactions) and insert their own transactions before and after yours. This is called front running and is a form of maximal extractable value (MEV). The most common front running attack is the sandwich attack, described below.

Slippage Tolerance: What It Really Does

When you set a slippage tolerance in your wallet, you are not telling the exchange to “try to get a good price.” You are setting a maximum acceptable deviation from the quoted price. If the actual execution price would be worse than your tolerance, the transaction will fail (revert) and you will not lose funds. For example, if you set a 1% tolerance and the price moves 2% against you, the swap will not execute.

This tolerance serves two purposes:

  1. It protects you from unexpected price movements. If the market moves between the time you sign the transaction and the time it is mined, the tolerance ensures you do not accept a wildly different price.
  2. It determines how much of a price move you are willing to accept. A higher tolerance means you are willing to accept a worse price, which can be necessary for trades that would otherwise fail due to normal volatility.

However, a high tolerance also means you are willing to accept a worse price due to front running. An attacker can see your transaction with a high tolerance and insert a buy order before yours, driving the price up, and then a sell order after yours, profiting from the price difference. This is the sandwich attack.

Sandwich Attacks: How They Work

A sandwich attack works like this:

  1. Attacker sees your pending transaction in the mempool. They see that you are buying token A with token B, and they see your slippage tolerance.
  2. Attacker places a buy order for token A before your transaction, driving the price up.
  3. Your transaction executes at the higher price, which is within your tolerance.
  4. Attacker places a sell order for token A after your transaction, selling at the inflated price and profiting from the difference.

The attacker profits at your expense. The higher your slippage tolerance, the more room the attacker has to manipulate the price. If your tolerance is low, the attacker cannot push the price beyond it without your transaction failing, so the attack is not profitable.

The Misdiagnosis: “Slippage Is a Fee”

A common misunderstanding is that slippage is a fee charged by the exchange or the network. It is not. Slippage is the difference between the expected price and the actual price, and it is caused by market mechanics. Another misconception is that setting a high slippage tolerance is harmless because it just allows the trade to go through. In reality, a high tolerance is an invitation for front runners. The natural mistake is to think that the slippage tolerance is a safety limit that protects you, when in fact it is a permission slip that tells the network how much price movement you are willing to accept. This is a natural mistake because the term “tolerance” sounds like a protective measure, and many wallet interfaces present it as a simple setting without explaining the risks.

How to Manage Slippage

To minimize slippage and reduce the risk of sandwich attacks:

  • Set a low slippage tolerance (e.g., 0.5% or 1%) for trades on liquid pairs. This reduces the room for front running.
  • Use limit orders if available. Some DEXs offer limit orders that execute at a specific price, avoiding the need for high tolerance.
  • Trade on deep liquidity pools. Larger pools have less price impact, so slippage is naturally lower.
  • Avoid trading during high volatility when price swings are larger.
  • Use private transaction services (e.g., Flashbots) that hide your transaction from the mempool, but be aware that these may have their own costs.

Comparison: Slippage Causes and Fixes

The table below summarizes common causes of slippage and whether a given fix applies.

CauseExampleFixDoes NOT Apply When
Low liquidityTrading a small-cap token with a thin poolUse a deeper pool or split the tradeThe pool is deep enough that price impact is negligible
High volatilityPrice moves 5% in secondsSet a lower tolerance and wait for stabilityThe market is calm and the price is stable
Front runningAttacker inserts transactions around yoursUse a private transaction serviceThe network has no mempool (e.g., some L2s)
Large trade sizeSwapping a large amount relative to poolSplit into smaller tradesThe trade is small relative to pool size

What People Get Wrong About Slippage

The most common error is setting a very high slippage tolerance (e.g., 10-20%) to ensure a trade goes through, especially when buying new or volatile tokens. This is often done out of fear that the transaction will fail. However, a high tolerance is exactly what enables sandwich attacks. The attacker does not need to push the price beyond your tolerance; they just need to push it within it. A 10% tolerance gives them a 10% window to profit.

Another mistake is assuming that slippage is the same as the spread on a centralized exchange. On a CEX, the spread is the difference between the best bid and ask, and you can see it. On a DEX, slippage is dynamic and depends on the pool and the trade size. It is not displayed as a fixed number until you set your tolerance.

A third misconception is that slippage only matters for large trades. In reality, even small trades on illiquid pairs can suffer significant slippage. The key factor is the ratio of trade size to pool liquidity, not the absolute size.

Keeping slippage under control

Slippage is an inherent part of trading on AMMs. It is not a fee, and it is not something you can eliminate entirely. What you can control is your slippage tolerance, and that control has direct consequences for your exposure to front running. By keeping your tolerance as low as practical and trading on liquid pairs, you reduce both the cost of slippage and the risk of sandwich attacks. Understanding these mechanics allows you to predict what will happen when you change your settings or trade on a new pair, even if the specific numbers differ.

Common questions

Why did I get a different price than what I saw on the exchange?

The price you see is the current market price, but your trade changes the pool's ratio, which moves the price. This is price impact. Additionally, other transactions may be processed before yours, moving the price further. The difference is slippage.

What is a good slippage tolerance to set?

A good tolerance is as low as possible while still allowing your trade to go through. For liquid pairs, 0.5% to 1% is often sufficient. For illiquid pairs, you may need higher, but be aware that higher tolerance increases the risk of front running.

What is a sandwich attack?

A sandwich attack is a form of front running where an attacker places a buy order before your transaction and a sell order after it, profiting from the price movement. The attacker needs your slippage tolerance to be high enough to allow the price to move.

Can I avoid slippage entirely?

No, slippage is inherent to AMM trading. You can minimize it by trading on deep liquidity pools, using limit orders, and keeping your tolerance low. You cannot eliminate it completely.

Does slippage apply to all crypto trades?

Slippage applies to trades on decentralized exchanges that use AMMs. On centralized exchanges, the equivalent concept is the spread, but the mechanics are different. On DEXs, slippage is always present, but its magnitude varies.

Read next