loading prices...
prices by coingecko
onchain.search tools/free · no sign-up/links/about

home / defi / uniswap-v2-swap-calculatorlocal

Uniswap v2 Swap Output Calculator

Calculate the output, price and price impact of a swap in a constant-product (x*y=k) pool.

uniswap-v2-swap-calculatorready · runs in this browser

Runs locally in your browser. Nothing you type is sent anywhere.

defi tools · free · runs in your browser · no sign-up · no wallet

01 // about this tool

Uniswap v2 style pools keep reserves x and y with x*y constant. A swap of amount in returns out = in*(1-fee)*reserveOut / (reserveIn + in*(1-fee)). Bigger trades move the price more, which is the price impact. Enter amounts in whole token units, not raw units.

02 // how to use it

  1. Enter both pool reserves.
  2. Enter the amount you will swap in and the pool fee (0.3 for standard v2).
  3. Press Run to see output, prices and impact.

03 // faq

Does this work for Uniswap v3?

No. v3 uses concentrated liquidity, so this formula does not apply.

Where do I find the reserves?

Call getReserves() on the pair contract, then adjust for each token's decimals.

04 // related tools

all 20 defi tools →