DEX Slippage Calculator

Calculate expected slippage and minimum received on DEX token swaps

Enter pool reserves for token A and B, trade size, and fee tier to compute price impact, expected output, minimum received at your slippage tolerance, and effective swap price versus spot. Uses the Uniswap V2 constant-product formula for DeFi traders. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What formula does this use?

The Uniswap V2 constant-product rule: reserve A times reserve B stays constant. With a fee, the input is scaled by one minus the fee before it is added to the reserve, and the output is what keeps the product constant. This is the exact maths an on-chain V2 swap executes.

Every DEX swap pays the pool fee and moves the price against you. This calculator uses the exact Uniswap V2 constant-product formula to show your expected output, price impact, effective price, and the minimum-received floor that protects the trade.

How it works

For a swap of dx of token A into a pool with reserves x and y, with fee f:

dx_eff = dx × (1 − f)
dy     = (y × dx_eff) / (x + dx_eff)      ← output of token B

spot price      = y / x                    (B per A, pre-trade)
effective price = dy / dx                  (B per A you actually get)
price impact    = 1 − effective / spot
min received    = dy × (1 − slippage tolerance)

Because x × y must stay constant, the more you buy the steeper the marginal price, which is exactly why large trades suffer.

Worked example

Suppose you are swapping 10 units of token A into a pool with reserves of 1,000 A and 2,000 B, and the pool charges a 0.3% fee.

  1. Fee-adjusted input: 10 × (1 − 0.003) = 9.97 A entering the pool.
  2. Output: (2,000 × 9.97) / (1,000 + 9.97) ≈ 19.74 B.
  3. Spot price before trade: 2,000 / 1,000 = 2.0 B per A.
  4. Effective price: 19.74 / 10 = 1.974 B per A.
  5. Price impact: (2.0 − 1.974) / 2.0 ≈ 1.3%.
  6. Minimum received at 0.5% tolerance: 19.74 × (1 − 0.005) ≈ 19.64 B. If the on-chain output falls below 19.64, the swap reverts.

Now halve the reserves to 500 A and 1,000 B and run the same 10-unit trade: the impact roughly doubles to about 2.5%. Shallow pools amplify price impact dramatically — this is why liquidity depth matters so much on thinly traded pairs.

Setting slippage tolerance wisely

Too tight: a 0.1% tolerance on a volatile token means almost any price movement between quoting and execution causes a revert. You pay gas and get nothing.

Too loose: a 5% or higher tolerance on a popular token is an open invitation to sandwich bots. A bot front-runs your trade to move the price, then back-runs it to capture the spread — you execute at your tolerance floor and they pocket the difference.

A practical approach is to set tolerance 0.1–0.3% above your calculated price impact for liquid pairs, and 0.5–1.0% for illiquid ones. This calculator shows your actual price impact so you can calibrate rather than guess.

Notes on V3 and aggregators

This calculator models the Uniswap V2 constant-product (x×y=k) formula, which applies to most simple AMM pairs. Uniswap V3 uses concentrated liquidity and yields different (often better) output for the same trade size. Aggregators like 1inch split orders across multiple pools to reduce impact. Use this tool for V2-style pairs and as a sanity check on any quoted output from a wallet or aggregator.