The number a DEX shows you before you swap is a mid price, and it is lying to you a little. Not maliciously, it just answers a different question than the one you care about. It tells you what one token is worth right now against the other, at the margin, for an infinitely small trade. What you want to know is what your specific trade will cost, all in, once you push the pool around by the size you are pushing it. Those two numbers diverge the moment your order stops being tiny relative to the pool, and on a lot of pairs they diverge a lot more than the interface lets on.
So it is worth working the math yourself, at least roughly, before you sign anything. It is not hard, and after a few times you start to feel the shape of the cost curve without a calculator.
The constant product curve, and why your average price is worse than the quote
Start with the classic constant product AMM, the Uniswap v2 style pool. It holds a reserve of token X and a reserve of token Y, and it enforces one rule on every trade: the product of the two reserves stays constant. Call it x times y equals k. When you sell some amount of X into the pool, the pool's X reserve goes up and its Y reserve has to come down just enough to keep k unchanged. The Y you receive is the difference.
The spot price you see quoted is just the ratio of the reserves, y over x. But your trade does not execute at that ratio. As you add X, the reserve ratio slides the whole way through your order, and every marginal unit you sell gets a slightly worse rate than the one before it. Your realized price is the average over that slide, and the average always sits worse than the starting spot price. That gap is the price impact. It is not a fee anyone charges you, it is geometry.
Here is the useful way to compute the output. If you sell an amount dx of token X into reserves x and y, and there is a fee rate f (0.003 for a 30 basis point pool), the amount of Y you get out is:
dy = (y times dx times (1 minus f)) divided by (x plus dx times (1 minus f)).
Everything you need is in that expression. Your effective price is dy divided by dx. Your price impact is how far that effective price is from the starting spot price y over x. And the thing to notice is that dx sits in the denominator, so the bigger your trade relative to x, the harder the effective price falls away. A trade that is one percent of the pool's X reserve costs you roughly one percent in impact before fees. A trade that is ten percent of the reserve costs far more than ten times that, because the curve is convex. This is the single most important intuition: doubling your size much more than doubles your impact.
Concentrated liquidity changes the depth, not the shape of the trap
Uniswap v3 and its descendants let liquidity providers concentrate capital in a price range instead of spreading it across the entire curve from zero to infinity. Inside an active range, the pool behaves like a v2 pool with far deeper reserves than the token count suggests, so small and medium trades near the current price get much better execution. That is the whole selling point, and for most swaps it delivers.
The catch is that the depth is only there inside the range. The quoted price impact on the interface is computed against the liquidity that exists right now, at the current tick. If your trade is large enough to walk the price out of the concentrated band, you cross into thinner liquidity, or into a gap where almost no one has provided at all, and the marginal price gaps hard. The quote you saw was accurate for the first slice of your order and wildly optimistic for the tail of it. You do not find out until the fill comes back.
So with concentrated liquidity, the mental model is: cheap and deep near the current price, then a cliff you cannot see from the quote. The way to protect yourself is to care about how the impact scales as you increase size. Pull a quote for your intended size, then pull one for half that size, and one for double. If doubling your size roughly doubles the impact, you are inside the deep band and fine. If doubling your size quadruples the impact or worse, you are near the edge of the range and should split the order or route it differently.
Why multi-hop routes hide their real cost
Now the part that catches people who thought they had this figured out. When there is no direct pool for the pair you want, or a routed path is cheaper, your swap goes through two or more hops. Sell A for B in one pool, then B for C in another. Each hop has its own price impact, and the interface often shows you one blended impact number for the route. That number understates your cost, and here is why.
The impacts compound, they do not add. The output of hop one is the input of hop two, so if hop one already moved you three percent off its mid, hop two operates on an amount already down three percent, and its own impact stacks on that reduced base. Two hops that each look like a two percent impact do not cost you four percent, they cost you closer to the product, and the effect grows with the number of hops and how thin any single leg is. A route can look clean on the summary line while one shallow intermediate pool quietly eats most of your value.
A few habits that keep this from biting you:
- Read the impact on each hop separately, not just the route total. One shallow leg tells you more than the blended average ever will.
- Prefer fewer hops when the difference is marginal. Every extra pool is another convex curve stacked on your trade, and another intermediate token you are briefly exposed to.
- Size against the shallowest pool in the path, not the deepest. Your worst leg sets your real cost.
- Sanity check the all in number: take the tokens you actually expect to receive, price them against the tokens you put in, and compare that realized rate to the mid you started from. That single ratio is your true cost, fees and impact and routing included. If it is worse than you are willing to eat, split the order or wait.
The whole exercise comes down to one discipline. Do not trust the headline impact number as your cost estimate. Reconstruct the effective price yourself from expected output over input, check how it scales when you change size, and look at the worst leg on any route. When I am watching a large wallet move size on chain through our execution tooling at Blockcircle, this is the check that separates a trade that mirrors well from one that looks great on the entry and bleeds out on the fill. The pool does not care what the interface promised you. It only knows k, and k is indifferent to your optimism.