On a constant-product AMM your trade literally bends the price curve. This calculator takes pool reserves and a trade size and reports the spot price, the post-trade marginal price, the percentage impact, and the output you receive after the protocol fee.
How it works
The pool obeys x * y = k. Swapping dx of the input token (after fee f):
dx_eff = dx * (1 - f)
new_x = x + dx_eff
new_y = k / new_x where k = x * y
dy = y - new_y (output received)
spot price (out per in) = y / x
post-trade price (out per in) = new_y / new_x
price impact = 1 - post-trade / spot
Because k is fixed, draining the output reserve raises the price of each remaining unit — the curve is convex, so impact accelerates with trade size.
Worked example
Suppose the ETH/USDC pool has 500 ETH and 1,000,000 USDC, so k = 500,000,000.
- Spot price: 1,000,000 / 500 = 2,000 USDC per ETH
- Trade: buy 50 ETH with USDC (0.3% fee applied to USDC input)
- To receive 50 ETH: new_y = 450 ETH, so new_x = k / 450 = 1,111,111 USDC
- USDC in (before fee): 1,111,111 - 1,000,000 = 111,111 USDC input (before accounting for fee exactly)
- Post-trade price: 1,111,111 / 450 = 2,469 USDC per ETH
- Price impact: (2,469 - 2,000) / 2,000 = ~23.4%
A 10% reduction in the output reserve of a constant-product pool causes roughly 11% price impact; a 33% reduction causes roughly 50% impact. The relationship is non-linear.
How pool depth determines impact
The same trade size has wildly different impact depending on pool depth (total reserves):
| Pool size (each side) | Trade size | Approx. price impact |
|---|---|---|
| 1,000 tokens | 100 tokens | ~18% |
| 10,000 tokens | 100 tokens | ~2% |
| 100,000 tokens | 100 tokens | ~0.2% |
| 1,000,000 tokens | 100 tokens | ~0.02% |
This is why liquidity depth is so critical to AMM quality — deeper pools give better execution to the same trade.
Strategies to reduce impact
- Split across pools: If multiple pools exist for the same token pair, routing through several of them at lower sizes per pool reduces impact on each.
- Use a TWAP or limit order: Time-weighted average price orders spread a large swap across many blocks, reducing per-block impact.
- Wait for liquidity events: Fees attract more liquidity providers over time; executing a large trade after a significant LP deposit reduces impact.
- Aggregators: DEX aggregators like 1inch or Paraswap route through multiple pools and use pathfinding to minimise impact automatically.
Why MEV researchers use this
Price impact is the quantity that makes sandwich attacks profitable. A searcher’s bot identifies a pending high-impact swap in the mempool, front-runs it to buy the output token cheaply, lets the victim’s swap push the price up, then immediately sells at the higher post-trade price. The profit to the sandwicher equals roughly the price impact their front-run caused times the size of their position. This calculator shows exactly how much value a large naive swap leaves exposed.