Quick answer
An automated market maker (AMM) is a smart contract that holds a pool of two or more tokens and sets swap prices with a mathematical formula instead of an order book. When you trade, you add one token to the pool and take the other out, and the formula decides how much you receive based on the pool's balances.
The most common design uses the constant product formula, written as x*y=k. It means a pool can always quote a price, but the price moves against you as your trade gets larger relative to the pool. That is the core idea behind slippage and price impact on decentralized exchanges.
Order books vs automated market makers
Traditional exchanges use an order book: buyers post bids, sellers post asks, and a trade happens when they meet. Prices come from many people actively placing and canceling orders, often professional market makers.
On a blockchain, maintaining an order book is expensive and slow, because each order update would be a transaction with a fee. An automated market maker replaces the crowd of market makers with a single pool and a rule. Liquidity providers deposit tokens once, and the contract handles every trade without anyone placing orders.
This design made it possible for an AMM DEX to list any token pair as soon as someone creates a pool, with no listing process and no counterparty needed. The trade-off is that the formula, not human judgment, sets the price.
The constant product formula (x*y=k)
In a constant product pool, x is the amount of one token, y is the amount of the other, and k is their product. The rule is that after every trade (ignoring fees), x multiplied by y must still equal k.
The current price of the first token, measured in the second, is simply y divided by x. If a pool holds 1,000 of token A and 2,000 of token B, one A is priced at 2 B.
When you buy token A, you add B and remove A. Because k must stay the same, every extra unit of A you take requires a larger amount of B than the previous one. The pool never runs completely dry, because the price of the last units approaches infinity. This curve is the basis of liquidity pool pricing in the original Uniswap design, described in our Uniswap protocol overview, and in many protocols that copied it.
Worked example: how pool size shapes your price
Hypothetical example with round numbers, fees ignored. A pool holds 1,000 token A and 1,000 token B, so k = 1,000,000 and the starting price is 1 B per A.
Small trade: you send 10 B. The pool now has 1,010 B, so it must hold 1,000,000 / 1,010 = about 990.1 A. You receive about 9.9 A, an average price of about 1.01 B per A. Price impact is roughly 1%.
Medium trade: you send 100 B. The pool has 1,100 B and about 909.1 A, so you receive about 90.9 A at an average of 1.1 B each. The new pool price is about 1.21 B per A.
Large trade: you send 500 B. The pool has 1,500 B and about 666.7 A, so you receive about 333.3 A at an average of 1.5 B each, 50% above the starting price.
The lesson: the same formula produces a fair price for small trades and a poor one for trades that are large compared with the pool. A pool ten times deeper would give the 500 B trade a much better result.

Price impact, slippage and arbitrage
Two related terms come up in every AMM interface:
Price impact is the price change caused by your own trade, as in the example above. It is known before you submit and depends on trade size and pool depth.
Slippage is any extra difference between the quote and the final execution, caused by other trades that land before yours. You control it with a slippage tolerance; see our guide on slippage in DeFi.
An AMM does not know prices on other exchanges. After the large trade above, token A is more expensive in the pool than elsewhere. Arbitrage traders then sell A into the pool and buy it cheaper elsewhere until the prices realign. This keeps AMM prices close to the wider market, but the profit arbitrageurs earn comes from the pool, which is one reason liquidity providers experience impermanent loss.
Where liquidity comes from and how fees work
Pools are funded by liquidity providers who deposit both tokens at the current ratio. In return they receive a claim on a share of the pool, often called LP tokens or an LP position.
Each swap pays a small fee, for example a fraction of a percent of the input amount, which stays in the pool. Over time this makes the pool grow slightly, so providers can withdraw more than the fee-free formula alone would give them. Whether fees outweigh price divergence depends on trading volume, volatility and the pair. Our beginner guide to liquidity pools covers the provider side, and impermanent loss explained shows how price moves affect a position.
Other AMM designs
The constant product model is not the only one. Developers have adapted the curve for different needs:
Stable-swap curves stay nearly flat around a 1:1 ratio, giving low price impact for assets meant to trade at the same value, such as two stablecoins.
Weighted pools hold tokens in ratios other than 50/50, for example 80/20, and can include more than two assets.
Concentrated liquidity lets providers place capital within a chosen price range, so less capital produces deeper liquidity near the current price.
Dynamic fees adjust the fee based on volatility or other conditions, to compensate providers when risk is higher.
Risks and what to check before swapping
The formula guarantees that a swap can execute, not that the price is good or the token is legitimate. Before using an automated market maker:
Verify the token's contract address, since anyone can create a pool for a fake copy of a known token.
Check pool depth and the displayed price impact; split or skip a trade if impact is high.
Use a modest slippage tolerance to limit exposure to sandwich attacks.
Remember the underlying smart contracts can have bugs, and token prices can be highly volatile. Do your own research before committing funds.
If you only need a straightforward exchange between two coins, an instant service like SimpleSwap offers fixed and floating rate options without managing pools or approvals yourself.
FAQ
What does AMM stand for in crypto?
AMM stands for automated market maker, a smart contract that prices trades with a formula based on the tokens held in a liquidity pool.
What does x*y=k mean?
It is the constant product formula: the amounts of the two tokens in a pool, multiplied together, must stay constant during a trade, which determines how much of one token you get for the other.
Why did I get fewer tokens than the quoted price suggested?
Your trade moved the pool's price (price impact), other trades may have executed first (slippage), and the pool fee was deducted from the input.
Can an AMM run out of a token?
Not under the constant product formula. As one token becomes scarce, its price rises toward infinity, so the pool can never be fully drained by trading.
Are AMMs better than order books?
Neither is better in every case. AMMs are simple and always available on-chain, while order books can offer tighter prices for large trades when active market makers are present.



