Automated Market Makers (AMMs) Explained
An automated market maker lets you swap tokens against a liquidity pool instead of an order book. Learn how AMM pricing, fees, slippage and risks work.
An automated market maker (AMM) is a smart contract that lets you swap one token for another by trading against a pool of tokens, with prices set by a mathematical formula rather than by matching buyers and sellers in an order book. Anyone can deposit tokens into the pool to provide liquidity and earn a share of the trading fees.
AMMs are the engine behind most decentralized exchanges (DEXs). If you have ever swapped tokens in a wallet app or on a DEX, you have almost certainly used one. Understanding how they price trades helps you avoid overpaying on swaps and judge the risks before you deposit funds as a liquidity provider.
How an Automated Market Maker Works
A traditional exchange keeps an order book: a list of buy and sell orders at different prices. A trade happens when a buyer and seller agree on a price. An AMM removes that matching process. For a deeper look, see What Is a DAO? Decentralized Autonomous Organizations Explained.
Instead, a smart contract holds a pool, for example ETH and a stablecoin. When you want ETH, you add stablecoins to the pool and take ETH out. The contract calculates how much ETH you receive using its formula. No one on the other side has to be online. We cover this in more detail in What Is DeFi? Decentralized Finance Explained.
The constant product formula
The best-known formula is x × y = k, popularized by Uniswap on Ethereum. Here x and y are the pool's balances of the two tokens and k is a constant.
A simplified example, ignoring fees:
- 1A pool holds 10 ETH and 20,000 stablecoins, so k = 200,000. The implied price is 2,000 stablecoins per ETH.
- 2You buy 1 ETH. The pool must still satisfy x × y = 200,000, so with 9 ETH left it needs about 22,222 stablecoins.
- 3You therefore pay roughly 2,222 stablecoins for that ETH, more than the starting price of 2,000.
The difference is price impact. The bigger your trade relative to the pool, the further you move along the curve and the worse your average price. That is why deep pools matter. For a related outlook, read Curve DAO price prediction 2026–2027.
Why AMM prices stay close to market prices
The formula only knows about its own pool. If ETH becomes cheaper on another exchange, the pool price is now too high. Arbitrage traders buy ETH elsewhere and sell it into the pool until prices line up again. This keeps AMMs useful, but the profit arbitrageurs make comes out of the pool, which is the root of impermanent loss. Related reading: Uniswap vs Curve.
Common AMM Designs
| Design | How it prices | Best suited to |
|---|---|---|
| Constant product (x × y = k) | Price changes smoothly with balances | General token pairs |
| Stable swap curves | Very flat curve near a 1:1 price | Assets meant to trade at the same value, such as stablecoins |
| Weighted pools | Tokens held in set percentages, not always 50/50 | Index-style pools with several tokens |
| Concentrated liquidity | Providers choose a price range for their funds | Active providers seeking higher capital efficiency |
Curve is widely known for stable swap pools, which allow large swaps between similar assets with little price impact. Concentrated liquidity is covered in our article on concentrated liquidity.
Who Provides the Liquidity and What They Earn
Liquidity providers (LPs) deposit both tokens of a pair, usually in equal value. In return they receive LP tokens or a position NFT that represents their share of the pool. Our Convex Finance (CVX) explainer covers the project's basics, use cases and risks.
Every swap pays a fee, typically a fraction of a percent, which is added to the pool. When LPs withdraw, they receive their share of the pool, including accumulated fees. Some protocols add token rewards on top, which is known as liquidity mining. Our guide to liquidity pools explains the deposit process step by step. For a deeper look, see Yield Farming Explained.
The Risks of Using AMMs
Risks for liquidity providers
- Impermanent loss. When the price of one token moves relative to the other, the pool rebalances and you end up with more of the token that fell and less of the one that rose. Compared with simply holding, you can be worse off. Our article on impermanent loss with simple examples shows the math.
- Bad tokens. Anyone can create a pool for any token. If one side is a scam token that goes to zero, LPs are left holding it.
- Smart contract risk. Bugs or exploits in the AMM or a related contract can drain pools.
Risks for traders
- Price impact and slippage. Thin pools give poor prices on large trades.
- Sandwich attacks. Bots can see your pending trade, buy before you and sell after you, pocketing the difference. A tight slippage tolerance limits how much they can take.
- Fake pools. A pool can carry the name of a famous token but contain a copycat. Always check the contract address.
How to Use an AMM More Safely
- 1Verify the token contract against official sources before swapping. Our guide to verifying a token's contract address shows how.
- 2Check the quoted price impact shown in the interface. If it is several percent, split the trade or use a deeper pool.
- 3Set a sensible slippage tolerance. Too low and the trade fails; too high and you invite sandwich attacks.
- 4Use the official app URL and bookmark it, since phishing copies of popular DEXs are common.
- 5Review token approvals after trading, and revoke ones you no longer need.
You can compare decentralized exchanges and their trading activity on the DEX overview at Certified Crypto Market.
Bottom line
An automated market maker replaces buyers and sellers with a pool of tokens and a pricing formula. It makes trading available around the clock and lets anyone become a market maker, but the formula has consequences: big trades in small pools cost more, and liquidity providers carry impermanent loss and contract risk. Check the pool, the token and the price impact before every trade.
Frequently asked questions
What is an automated market maker in simple terms?
An automated market maker is a smart contract that holds a pool of two or more tokens and lets anyone trade against it. Instead of matching buyers with sellers, it sets the price with a mathematical formula based on how much of each token is in the pool. Liquidity providers supply the tokens and earn a share of trading fees.
How does an AMM decide the price?
Most AMMs use a formula tied to the pool's balances. In the common constant product design, the two token balances multiplied together must stay the same after each trade, so buying one token makes it scarcer in the pool and raises its price. Arbitrage traders keep the pool price close to prices on other markets.
Is providing liquidity to an AMM safe?
It carries real risk. Liquidity providers can suffer impermanent loss when prices move, the smart contract can have bugs, and one of the pooled tokens can collapse in value or turn out to be a scam. Fees can offset some losses, but not always. Start small and understand the pool before depositing.
Why did my AMM trade get a worse price than shown?
Large trades relative to the pool size move the price along the curve, which is called price impact. Prices can also change between submitting and confirming a transaction, which is slippage. Bots may also sandwich your trade. Smaller trades, deeper pools and tight slippage settings reduce the effect.
