If you have ever swapped one cryptocurrency for another on a decentralized exchange, you have used an automated market maker — even if you never saw it. AMMs are the engine underneath platforms like Uniswap and Curve, and they work in a fundamentally different way from the trading systems most people are familiar with.
**Trading Without a Counterparty**
On a traditional exchange, whether it is a stock market or a centralized crypto exchange, buyers and sellers are matched through an order book. You place a buy order at a price you are willing to pay, someone else places a sell order at a price they are willing to accept, and the exchange connects the two. The whole system depends on having enough people on both sides of a trade at any given moment.
A decentralized exchange (DEX) using an AMM throws that model out entirely. There is no order book, no matching engine, and no need for a willing counterparty on the other side of your trade. Instead, you are trading against a pool of funds locked in a smart contract.
**Liquidity Pools: The Core Concept**
An AMM holds pairs of tokens inside what is called a liquidity pool. A simple example would be a pool containing Ethereum and a stablecoin like USDC. Anyone can add tokens to this pool and become a liquidity provider. In return, they earn a small fee on every trade that runs through it.
When a user wants to swap ETH for USDC, they send ETH into the pool and receive USDC in return. No human on the other side is required. The pool itself is the market.
The question is: how does the pool know what price to give you?
**The Formula That Sets the Price**
This is where the math comes in. The most widely used AMM model, popularized by Uniswap, relies on a simple equation known as the constant product formula: x multiplied by y equals k.
Here, x is the quantity of one token in the pool, y is the quantity of the other, and k is a constant that must never change. When you buy ETH from the pool, you are removing ETH (decreasing x) and adding USDC (increasing y). To keep the product the same, the price of ETH in terms of USDC automatically rises as you take more of it out. The more you buy relative to the pool's size, the worse the rate you receive.
This price movement is called slippage, and it increases with trade size. A small trade on a large pool barely moves the price. A large trade on a small pool can move it significantly.
**Why It Works: Arbitrage**
You might wonder what stops the price inside a pool from drifting wildly out of sync with the rest of the market. The answer is arbitrage.
If ETH is priced at $2,000 on a centralized exchange but a liquidity pool still reflects $1,900, arbitrage traders will immediately buy the cheap ETH from the pool and sell it elsewhere until the gap closes. This constant activity by profit-seeking traders is what keeps DEX prices roughly in line with the broader market, without any central authority enforcing it.
**Liquidity Providers and Impermanent Loss**
Being a liquidity provider sounds straightforward — deposit tokens, earn fees — but there is an important risk called impermanent loss. When the price of one token in a pool shifts significantly relative to the other, liquidity providers end up holding a less favorable ratio of the two than if they had simply held the tokens in their wallet.
The loss is called "impermanent" because it only becomes real when the provider withdraws their funds. If prices return to where they were when liquidity was deposited, the loss disappears. In practice, however, prices often do not return, and the fees earned may or may not make up the difference. This is one of the most important concepts anyone considering becoming a liquidity provider needs to understand.
**Beyond the Basic Formula**
The constant product formula is just one approach. Different protocols have developed variations to solve specific problems.
Curve Finance was designed for trading between assets that should always be close in value, such as different stablecoins or wrapped versions of the same asset. Its formula keeps prices far more stable within a tight range, reducing slippage dramatically for those specific trades. Balancer extended the model to allow pools with more than two tokens and customizable weightings, making the pool itself behave more like an index fund.
Concentrated liquidity, introduced by Uniswap v3, let liquidity providers choose specific price ranges where they want their capital deployed rather than spreading it across all possible prices. This made capital far more efficient but also added complexity, since providers now need to actively manage their positions.
**What AMMs Enable**
AMMs made it possible for anyone to trade tokens without an account, without identity verification, and without trusting a centralized company to hold their funds. They also allowed anyone to become a market maker — a role previously reserved for well-capitalized financial institutions — simply by depositing tokens into a pool.
This shift is at the heart of what decentralized finance set out to build: financial infrastructure that runs on open code rather than institutional intermediaries.
Understanding AMMs does not require a background in mathematics or finance. At their core, they are pools of tokens governed by simple rules, kept honest by economic incentives, and accessible to anyone with an internet connection and a crypto wallet.