Price impact is the change in execution terms caused by your own trade consuming liquidity. Slippage is the difference between an execution outcome and a stated earlier benchmark. When that benchmark is a swap quote, the quote normally already includes its estimated price impact; quote-to-fill slippage measures the subsequent deviation. A slippage tolerance limits acceptable deterioration from that quote, so it does not remove an expensive quote's existing price impact.
Start with three different prices
A trader sees a token priced at 2,000 units, submits a swap and receives tokens at an average cost of 2,100. Calling the entire difference “slippage” leaves an important question unanswered: did the quote already predict 2,100, or did the outcome worsen after the trader approved it?
For this article, distinguish the initial marginal pool price, the quoted average execution price for a specified size, and the eventual average execution price. These answer different questions.
| Reference | What it describes | Useful comparison |
|---|---|---|
| Initial marginal pool price | Exchange rate for an infinitesimal trade before fees | How much the sized quote differs from the starting rate |
| Sized swap quote | Estimated total output for the chosen input, route and state | How much execution changes after the observation |
| Realized average price | Actual input divided by actual output | What the completed swap cost in token units |
Uniswap's swap documentation distinguishes movement along available liquidity from changes while a transaction is pending. Other execution reports can use “slippage” more broadly. A report measured against an earlier market price can include the trade's own impact. The label alone cannot identify what was measured.
The benchmark also needs a source. A pool's reserve ratio, an exchange midpoint and a last trade are separate observations. The last price versus midpoint guide explains why changing that reference can change the apparent execution cost without changing a fill.
Calculate the quote's own curve cost first
Consider a hypothetical constant-product pool holding 100 X and 200,000 Y. Prices are Y per X; Y is a token unit, not an assumed dollar. Start with a deliberately fee-free teaching model, ordinary tokens, no competing transactions and no liquidity changes.
The starting marginal price is 200,000 ÷ 100 = 2,000 Y/X. The product of the two reserves is 20,000,000. A trader supplies 10,000 Y to buy X.
Maintaining that product leaves 20,000,000 ÷ 210,000 = 95.238095 X in the pool. The trader therefore receives 4.761905 X. The average purchase price is 10,000 ÷ 4.761905 = 2,100 Y/X, using unrounded values in the calculation.
| Fee-free measurement | Result | Meaning |
|---|---|---|
| Output at the unchanged initial rate | 5 X | Hypothetical comparison with unlimited liquidity at 2,000 |
| Output along the actual curve | 4.761905 X | Sized quote under the stated model |
| Average execution price | 2,100 Y/X | 5% above the initial marginal price |
| Terminal marginal pool price | 2,205 Y/X | Rate at the end of the swap, 10.25% above the start |
The 5% average price premium is already present before submission. If the pool remains unchanged and execution matches the quote, quote-to-fill slippage is zero. The trader still pays the curve cost.
Expressing that same curve effect as missing output gives a different percentage: (5 − 4.761905) ÷ 5, or about 4.761905%. The 5% figure compares prices; the 4.761905% figure compares token output. Check an interface's calculation before comparing its price-impact percentage with either one.
The terminal marginal price is also different from the average paid. Charging all purchased units at 2,205 would overstate this example's expenditure. Conversely, pretending every unit remains available at 2,000 would overstate output.
This simplified invariant is related to the model documented in Uniswap v2 pricing. A deployed v2 swap also accounts for fees. Concentrated liquidity requires a different path calculation; the active-range execution example covers that case.
Restore fees, then introduce one intervening trade
Now use the same starting reserves and intended input with the 0.30% input-fee calculation in the original Uniswap v2 library. Its adjusted input is 9,970 Y. Output equals the X reserve multiplied by adjusted input, divided by the Y reserve plus adjusted input.
The new quote is 4.748297 X, averaging 2,106.018054 Y/X. This is a fee-inclusive quote. Calling its entire difference from 2,000 “pure price impact” would mix the fee with the curve effect. Real contracts calculate integer token amounts; these decimal figures deliberately ignore that rounding.
Suppose a different trader buys X with 1,000 Y before our intended swap executes. Under the same fee rule, that buyer receives 0.496027 X. The pool now holds about 99.503973 X and 201,000 Y. The full 1,000 Y enters its reserve; only the pricing calculation discounts input for the fee.
Recompute our unchanged 10,000 Y instruction against that new state:
| Hypothetical timeline | X reserve before our swap | Y reserve before our swap | Our estimated X output |
|---|---|---|---|
| Quote observed | 100 | 200,000 | 4.748297 |
| Other buyer trades first | 99.503973 | 201,000 | Recalculation needed |
| Potential execution after that buyer | 99.503973 | 201,000 | 4.702349 |
The last row is a potential fill, conditional on the transaction's checks allowing it. Its average price is 2,126.596644 Y/X. No second fee is added to that figure: it already uses gross input and the modeled output after the swap fee.
For an output-based adverse-slippage measure, divide the lost output by the quoted output: 1 − 4.702349186 ÷ 4.748297376 = approximately 0.967677%. For an average-price measure, divide the new average by the quoted average and subtract one: approximately 0.977133%.
Those percentages differ because output and price are reciprocals when input is fixed. Report the definition alongside the value. Likewise, do not add an output shortfall to an average-price premium: the units and denominators differ.
A tolerance checks the quote's floor
Assume an integration converts a chosen output tolerance directly into a minimum: quoted output multiplied by one minus the tolerance. This explicitly stated convention lets us evaluate the example without assuming every interface implements its percentage identically.
| Illustrative output tolerance | Minimum acceptable X | Does 4.702349 X clear this floor? |
|---|---|---|
| 0.50% | 4.724556 | No |
| 1.00% | 4.700814 | Yes |
These are comparisons, not recommended settings. In the selected v2 Router02 exact-input function, the router checks its computed final output against amountOutMin and reverts if it is insufficient. Its exact-output function instead checks required input against amountInMax. The same source also applies a deadline check. Uniswap v2 Router02 source.
A passing minimum-output comparison is only one condition for success. Balance, allowance, deadline and other execution requirements still matter. The 1% row means this particular output floor accepts the modeled deterioration; it does not establish that a live transaction will succeed.
With no intervening trade, the fee-inclusive quote of 4.748297 X would pass either floor. Its average cost would still be about 5.300903% above the original 2,000 Y/X marginal price. Setting a 0.50% tolerance never promised to cap that whole difference at 0.50%.
Uniswap's interface help warns that tight tolerance can cause failure, while wider tolerance can accept fewer tokens. Treat a failure as a reason to inspect the instruction and refreshed quote. Automatically widening the boundary changes the outcome you authorize.
Diagnose the cause without inventing one
The constructed timeline tells us exactly what changed because its sole intervening event was specified. A real quote-to-fill gap does not provide the same causal evidence. Other swaps, liquidity changes, route changes or ordering can alter execution conditions.
Adams, Chan, Markovich and Wan's original Uniswap execution study separates benign and adversarial slippage in its methodology. That distinction matters: a worse fill alone cannot prove that a sandwich attack occurred. Their historical study of selected v3 pools also does not supply an attack probability for an arbitrary token today.
The same caution applies to centralized order books. A large instruction can consume worse levels, but a change in the best ask before arrival can reflect other participants. Use the order-book depth worksheet to model that mechanism rather than applying a constant-product formula to exchange depth.
Splitting a trade is another proposal to examine, not an automatic remedy. In the fee-free model, sequential pieces against the same unchanged curve reach the same endpoint as one combined trade. Improvement requires something else to change, such as available liquidity or routing; waiting also exposes the remaining instruction to future conditions.
Keep a worksheet that preserves both benchmarks
Before approving a swap, save enough information to explain the quote and later compare the outcome:
| Record | Validation question |
|---|---|
| Chain, token addresses, decimals and direction | Are the units and assets identical? |
| Pool or complete route, fee rule and state identifier | Which liquidity produced the estimate? |
| Gross input, quoted output and quote time | What instruction and observation were approved? |
| Initial reference price and its timestamp | What does the price-impact comparison use? |
| Minimum output or maximum input, plus deadline | Which deterioration would the transaction reject? |
| Actual input, output, fees, network cost and status | What settled, and what remains unresolved? |
Compare quoted and realized amounts before translating either into another currency. Then account for separately charged costs without adding a swap fee twice. A quote that excludes a provider charge cannot be compared directly with a receipt that includes it.
Also reconcile the resulting position. Spending the intended Y but receiving less X changes the acquired exposure; a tidy percentage does not complete that accounting. The gross versus net exposure guide develops the next portfolio check.
The useful decision record contains two separate judgments: whether the sized quote is acceptable relative to a named starting reference, and how much later deviation the instruction allows. Preserve both. A transaction can match an expensive quote perfectly, or reject an initially attractive quote after conditions change.
