Skip to content
PayableWithCrypto

Glossary

What Is an Automated Market Maker (AMM)? How DEX Prices Are Set

Editorial teamFact-checked against official sources Last updated 3 min read

Definition

Automated market maker (AMM): An automated market maker is a smart contract that quotes swap prices from a mathematical formula applied to the token reserves in a liquidity pool, instead of matching buyers and sellers.

On this page
  1. 1The constant product formula
  2. 2Price impact vs slippage
  3. 3Other AMM designs
  4. 4Why AMMs matter when you pay
  5. 5Practical tips
  6. 6Common questions

An automated market maker (AMM) is a smart contract that prices token swaps using a formula instead of an order book. It holds reserves of two or more tokens in a liquidity pool, and the ratio of those reserves sets the price. If you have ever swapped tokens in a wallet or on a DEX, an AMM probably quoted your rate.

The constant product formula

The best-known AMM design, used by Uniswap, follows x × y = k. Uniswap’s documentation explains that the pool “prices tokens algorithmically using a constant product formula”, where x and y are the reserves and k is an invariant that “must stay constant (or increase) after every trade”.

A simplified worked example, ignoring fees:

Step ETH reserve (x) USDC reserve (y) k Implied price
Pool starts 100 300,000 30,000,000 3,000 USDC per ETH
You buy 1 ETH 99 about 303,030 30,000,000 about 3,061 USDC per ETH
You paid about 3,030 USDC Average about 3,030 per ETH

The numbers are illustrative, not market prices. The point is that you paid about 1% above the starting price because your trade was 1% of the pool’s ETH. That gap is price impact.

Price impact vs slippage

These are related but different:

  • Price impact is the movement your own trade causes, determined by trade size relative to pool depth.
  • Slippage is the difference between the quote you saw and what you actually receive, which includes price impact plus any movement caused by other trades before yours lands.

Your wallet’s slippage tolerance caps the total. If the outcome would be worse than the limit, the transaction reverts, and you still pay the gas fee.

Other AMM designs

Design Used for Effect for traders
Constant product General token pairs Works for any pair; price impact grows with size
Stable-swap curves Stablecoin-to-stablecoin swaps Very low price impact near the peg
Concentrated liquidity Liquidity providers choose price ranges Deeper liquidity near the current price
Weighted pools Multi-token pools with custom weights Index-like exposure

Uniswap’s documentation notes that fees “are configured by pool and protocol version”, so the fee you pay depends on which pool your route uses.

Why AMMs matter when you pay

Converting before checkout

Swapping a volatile coin into a stablecoin before paying a merchant usually goes through an AMM. For a small, common pair like ETH/USDC on a major network, price impact is typically tiny. For an obscure token, it can be large, and the merchant still expects the full invoice amount.

Stablecoin swaps

Swapping USDT to USDC, or between bridged versions of a stablecoin, uses stable-swap pools designed for near-1:1 rates. If a quote is far from 1:1, check whether one of the coins has lost its peg; see depeg.

Prices are not oracle prices

An AMM’s price comes from its own reserves, not from an outside feed. During fast markets, a thin pool can quote a price well away from major exchanges until arbitrage catches up. Comparing the quote with another source before a large swap is worth the few seconds.

Practical tips

  1. Check the “price impact” line in the swap preview; above 1% on a common pair suggests a thin route.
  2. Use the network where the pair is deepest and fees are lowest.
  3. For larger amounts, split the swap or use an aggregator that routes across pools.
  4. Leave room for fees so the output still covers the invoice.
  5. Approve only the amount needed; see revoking token approvals.

For the broader context, see DeFi.

Frequently asked questions

What does x * y = k mean?
It is the constant product formula used by Uniswap-style pools. x and y are the pool's reserves of two tokens, and k is their product. Every swap must leave the product at least as large as before, which determines how much of one token you get for the other.
Why is the price worse for larger swaps?
Each unit you buy makes the remaining reserve scarcer, so the formula charges more for the next unit. Larger trades relative to pool size therefore move the price more. This is called price impact.
Who sets the AMM's price?
The formula does, based on reserves. Arbitrage traders keep it close to prices on other markets by trading whenever the pool drifts away. The AMM itself does not look at outside prices.
Is an AMM the same as a DEX?
An AMM is a pricing mechanism used by many DEXs. Some DEXs use order books or request-for-quote systems instead, and some aggregate several sources.

Sources

Facts were checked against these pages on the date shown above. Terms change; confirm on the official page before acting. General information, not financial, tax or legal advice. See our methodology.

Related terms

Compare cards Find a store