What Is an Automated Market Maker (AMM)
Learn what an automated market maker is, how liquidity pools and the constant product formula work, plus risks like impermanent loss. Beginner-friendly guide with examples.

What Is an Automated Market Maker (AMM)
Automated market makers are a foundational technology in decentralized finance (DeFi) that replace traditional order books with liquidity pools. These pools, funded by users called liquidity providers, use a mathematical formula to determine the price of tokens automatically. Because of this design, anyone can swap tokens instantly without waiting for a matching buyer or seller.

How Automated Market Makers Work
An automated market maker (AMM) operates through a smart contract that holds reserves of two or more tokens. Instead of an order book where bids and asks are matched, trades happen directly against the pool. The price of each token is set by a constant product formula, typically expressed as x * y = k. Here, x and y represent the reserves of two tokens, and k is a fixed constant.
For example, consider a liquidity pool for ETH and USDC. If the pool holds 10 ETH and 10,000 USDC, the constant k equals 100,000. When a trader swaps 1 ETH for USDC, they add ETH to the pool and remove USDC. The pool's reserves become 11 ETH and approximately 9,090.91 USDC (maintaining 11 * 9,090.91 ≈ 100,000). The price of ETH in terms of USDC rises because the relative supply of ETH increased. This automatic price adjustment maintains the product constant, discouraging arbitrage and ensuring liquidity at all times.
The Math Behind an Automated Market Maker

To understand the pricing mechanism more clearly, let's break down the constant product formula. For a pool with reserves of token A (amount a) and token B (amount b), the relationship is a * b = k. When a trade occurs, the smart contract calculates the new reserves such that the product remains unchanged, minus a small fee.
Suppose a pool has 30 ETH and 60,000 DAI (so k = 1,800,000). A trader wants to buy 2 ETH. To maintain the product, the new ETH reserve will be 32 ETH, and the new DAI reserve must satisfy 32 * b = 1,800,000, meaning b = 56,250 DAI. The trader therefore must deposit 3,750 DAI (60,000 – 56,250) into the pool. The price paid per ETH is 3,750 ÷ 2 = 1,875 DAI. Notice that before the trade, the implied price was 2,000 DAI per ETH (60,000 ÷ 30). The price impact, or slippage, occurs because the trade consumes a significant portion of the pool's liquidity. Larger pools reduce slippage for trades of the same size.
Providing Liquidity to an Automated Market Maker

Anyone can become a liquidity provider (LP) by depositing an equal value of both tokens in the pool. For the ETH/USDC pool, you would deposit, say, 1 ETH and 1,000 USDC (assuming a 1 ETH = 1,000 USDC ratio). In return, you receive liquidity pool tokens that represent your share of the total pool. Pool tokens can be redeemed for the underlying assets plus any earned fees.
- Earning fees: Every trade on the AMM charges a small fee (e.g., 0.3%). That fee is distributed proportionally among all LPs. If you hold 1% of the pool, you earn 1% of all fees collected.
- Impermanent loss: The main risk for LPs. If the relative price of the two tokens changes after you deposit, your pool share may be worth less than simply holding the tokens. For example, if ETH rises sharply, the pool will contain less ETH and more USDC due to arbitrage trading. When you withdraw, you get fewer ETH and more USDC than you deposited — a loss compared to hodling. This loss is “impermanent” because it can reverse if prices return to the original ratio, but it becomes permanent when you withdraw.
Advantages of Automated Market Makers
AMMs offer several benefits over traditional exchange models:
- 24/7 liquidity: The pool is always available for trading, even outside market hours, because trades happen directly against the reserves.
- Permissionless access: No account registration or KYC required. Anyone with a crypto wallet can swap tokens or provide liquidity.
- Transparent and predictable pricing: The formula determines prices on-chain; there is no hidden order book manipulation.
- Lower barriers for new tokens: Any token pair can be listed instantly — no need to attract market makers or meet exchange requirements.
Risks and Challenges for AMM Users
While AMMs are powerful, they come with unique risks that users should understand.
| Risk | Description | How to Mitigate |
|---|---|---|
| Impermanent loss | Price divergence between pooled assets reduces LP returns relative to hodling. | Provide liquidity to stablecoin pairs (e.g., USDC/DAI) or use protocols that offer loss protection. |
| Smart contract risk | Bugs or exploits in the AMM code can drain funds. | Only use well-audited, battle-tested protocols with a track record. |
| Slippage | Large trades cause significant price impact, especially in small pools. | Set a slippage tolerance limit in your wallet before swapping. |
| MEV (Miner Extractable Value) | Bots may front-run large trades to profit, increasing costs. | Use private transaction relays or choose pools with less front-running activity. |
Additionally, impermanent loss is often misunderstood. It is not a net loss unless the price change is extreme and you withdraw at an unfavorable time. Many LPs offset it with trading fees, especially in high-volume pools.
Conclusion
Automated market makers have democratized token exchange, enabling instant, permissionless swaps that power the entire DeFi ecosystem. By replacing order books with liquidity pools and a constant product formula, automated market makers provide continuous liquidity and allow anyone to earn fees as a liquidity provider. However, they also introduce risks such as impermanent loss and slippage that demand careful consideration. Mastering the fundamentals of an automated market maker is essential for navigating decentralized finance safely and effectively.
