Skip to content
DeFi

How Do Automated Market Makers Work? DEXs Explained

A plain-English guide to how decentralized exchanges price trades without order books, using constant-product formulas, liquidity pools, and arbitrage.

Sofia Lindqvist

Explainers Lead · Jun 3, 2026 · 7 min read

DEX

Decentralized exchanges, or DEXs, let you swap one token for another without handing custody to a company. Most of them do not use the order book you would see on a centralized venue. Instead they use an automated market maker (AMM): a smart contract that quotes a price algorithmically from the assets sitting inside it. Understanding the mechanism explains almost everything about DEX pricing, slippage, and fees.

What is an automated market maker?

An AMM replaces human market makers and matched buyers and sellers with a pool of two tokens and a formula. Anyone can deposit the pair, and anyone can trade against it. The formula decides the exchange rate based only on how much of each token the pool currently holds.

The most common design is the constant-product market maker, popularized by Uniswap. It enforces a simple rule:

x times y equals k, where x and y are the pool's token balances and k is a constant that trades must not change.

When you buy token Y, you add token X to the pool and remove some Y. Because the product must stay equal to k, removing Y makes it scarcer and pushes its price up. The larger your trade relative to the pool, the more the price moves against you. That movement is called slippage, and it is a direct consequence of the curve, not a fee.

Where does the price come from without an order book?

The instantaneous price a pool quotes is simply the ratio of its reserves. If a pool holds 1,000 ETH and 3,000,000 USDC, the marginal price is 3,000 USDC per ETH. There is no bid or ask spread in the traditional sense; there is a continuous curve of prices you slide along as you trade.

This raises an obvious question: what keeps a pool's price aligned with the wider market? The answer is arbitrage. If the pool quotes ETH cheaper than centralized exchanges, traders buy from the pool until the price rises back to market level, pocketing the difference. Arbitrageurs are unpaid but self-interested, and their activity is what keeps AMM prices honest.

How do liquidity providers and fees fit together?

The tokens in a pool come from liquidity providers (LPs), who deposit both assets in the correct ratio and receive LP tokens representing their share. Every swap charges a fee, commonly between 0.05% and 1%, which is added back to the pool. LPs earn this fee pro rata to their share.

Here is the typical LP lifecycle:

  • Deposit: supply equal value of both tokens and mint LP tokens.
  • Earn: collect a slice of every trading fee while your capital sits in the pool.
  • Withdraw: burn the LP tokens to reclaim your share of whatever the pool now holds.

The catch is that the composition changes with the price. When one token appreciates, arbitrageurs steadily buy it out of the pool, so you end up holding more of the token that fell and less of the one that rose. Compared with simply holding the two tokens, this shortfall is called impermanent loss. It is only realized when you withdraw, and fee income can offset it, but in volatile pairs it can outweigh the fees earned.

What are the different AMM designs and their trade-offs?

Not all AMMs use the same curve. The design choice tunes the pool for a specific type of asset pair:

  • Constant product (x times y equals k): works for any pair but concentrates slippage on large trades. General purpose.
  • Stableswap curves: used by protocols like Curve for assets meant to trade near parity, such as two dollar stablecoins. The curve stays nearly flat around the peg, giving very low slippage for like-for-like swaps.
  • Concentrated liquidity: introduced in Uniswap v3, this lets LPs supply capital only within a chosen price range. Inside that range their capital is far more efficient, earning more fees per dollar, but they earn nothing once price exits the range and must actively manage positions.

These variations all share the same core idea: a formula, a pool, and arbitrage. Once you see that, DEX behavior stops being mysterious. High slippage means your trade is large relative to available liquidity. A stablecoin swap barely moving price means you are on a flat curve. An LP underperforming a simple hold usually means impermanent loss overtook fee income.

Key risks to keep in mind

AMMs remove custodial risk but introduce others. Smart-contract bugs can drain a pool; audits reduce but never eliminate this. Thin liquidity produces punishing slippage and makes prices easy to manipulate, which is why oracles that read AMM prices can be exploited. And providing liquidity is an active financial position, not a passive savings account. None of this is financial advice, but knowing the mechanism lets you size trades and positions with your eyes open.

Share
Sofia Lindqvist

Explainers Lead

Sofia turns dense on-chain mechanics into plain English. She writes Coin Currents Daily's Learn desk and edits the glossary.