What Is an AMM in DeFi? Complete Guide 2026
— By Tony Rabbit in Tutorials

Automated market makers in DeFi explained: learn the x*y=k formula, concentrated liquidity, stable-swaps, top AMMs, and LP risks in this 2026 guide.
Before automated market makers existed, trading any token onchain required an order book matched by professional market makers who quoted bids and asks around the clock. That model worked beautifully on centralized exchanges with millisecond matching engines, but it collapsed almost immediately when developers tried to port it to decentralized exchanges. Gas fees made every order update expensive, block times made quotes stale, and there were simply not enough market makers willing to provide liquidity for thousands of long-tail tokens.
The automated market maker, often abbreviated as AMM, solved this problem with a surprisingly elegant trick. Instead of matching buyers with sellers through an order book, an AMM uses a mathematical formula to price assets inside a shared liquidity pool. Anyone can deposit two tokens into the pool, anyone can swap against it, and the formula automatically rebalances the price after every trade. No professional market makers, no order books, no human intervention. Just code, liquidity, and a deterministic curve.
In this complete guide you will learn exactly what an automated market maker is, why order books failed onchain, how the famous x*y=k constant product formula works in practice, the different families of AMM designs in use in 2026, how liquidity providers earn fees, the real risks involved for both LPs and traders, and which AMMs dominate the market today. By the end you will understand the engine that powers more than a trillion dollars in annual onchain trading volume.

What Is an Automated Market Maker?
An automated market maker is a smart contract that holds a reserve of two or more tokens and lets anyone swap between them at a price determined by a mathematical invariant. The contract acts as the counterparty for every trade. There are no buyers and sellers being matched against each other. There is only the pool and the trader, with the formula deciding the exchange rate based on the current ratio of reserves.
In traditional finance, a market maker is a firm that posts both a bid and an ask price for an asset and profits from the spread. Citadel, Jump, Susquehanna and others run sophisticated trading systems that quote prices on equities, futures and options exchanges every microsecond. They take inventory risk in exchange for capturing the spread. An AMM replaces that entire apparatus with two ingredients. The first ingredient is a pool of tokens deposited by passive liquidity providers (LPs). The second is a pricing formula that maps reserves to a current exchange rate. The combination is sometimes called a constant function market maker because the formula must remain constant after every trade.
The result is permissionless price discovery for any token pair anyone wants to create. If you launch a new ERC-20 token tomorrow, you do not need to convince Citadel to quote it. You just open a pool, deposit your token alongside ETH or USDC, and the AMM will price it automatically based on supply and demand. This single property is what made the explosion of liquidity pool economics and onchain token launches possible in the first place.
Why Order Books Failed On-Chain
Before AMMs took over, projects like EtherDelta, IDEX and 0x tried to bring full limit order books onchain. Every approach ran into the same brutal physics. Order books require constant updates as market makers quote and cancel, but every onchain update consumes gas. On Ethereum in 2018, posting a single limit order could cost several dollars. Cancelling it cost the same. Updating a quote a hundred times an hour, which is normal for a professional market maker, would have been economically suicidal.
Latency was the second killer. Even if you were willing to pay the gas, Ethereum confirmed blocks every 12 to 15 seconds. By the time your quote was mined, the price on Binance or Coinbase might have moved several percent. Predatory traders could pick off your stale order before you could cancel it. Without specialized order types, conditional cancels and millisecond cancel-on-disconnect logic, market makers refused to commit serious capital.
The third problem was capital efficiency for thin markets. An order book needs depth at every price level to function. For the top fifty tokens that might be feasible, but DeFi wanted to support thousands of long-tail assets. No professional market maker was going to quote bids and asks on every random ERC-20. AMMs solved this with one stroke. A passive LP could deposit liquidity once, walk away, and the formula would produce a quote at every price along an infinite curve. Coverage instead of precision, and for early DeFi, coverage was what mattered.
Order Book vs AMM: Side by Side
- Pricing: human market makers post quotes
- Matching: buyer matched directly to seller
- Liquidity: only at posted price levels
- Onchain cost: high gas per quote update
- Best for: deep liquid majors with active MMs
- Pricing: formula like
x*y=ksets it - Matching: trader swaps against pool reserves
- Liquidity: continuous across entire curve
- Onchain cost: one-time deposit, passive after
- Best for: long-tail tokens and permissionless markets
Both models still coexist in 2026. Order books survive on perpetual futures venues like Hyperliquid and dYdX where high-frequency MMs find the latency tolerable. AMMs dominate spot trading on Ethereum, Solana, Base, Arbitrum and almost every other smart contract chain. You can read a deeper comparison in our AMM vs order book DEX guide.
The Core Formula: Constant Product
The single most important formula in DeFi is the constant product invariant, written as x*y=k. Here x is the reserve of token A in the pool, y is the reserve of token B, and k is a constant that must not decrease after any swap. The current price of token A in terms of token B is simply the ratio y/x.
This single equation, introduced by Vitalik Buterin in a 2016 forum post and implemented by Hayden Adams in Uniswap V1 in 2018, is the engine behind hundreds of billions of dollars in cumulative trading volume. Its beauty is that it never runs out of liquidity. As one token gets bought, its reserve drops and its price rises asymptotically toward infinity. As the other token gets sold into the pool, its reserve grows and its price drops toward zero. The pool will quote a price at any size of trade, but extreme trades cost extreme slippage.
The constant product is not the only invariant possible. Constant sum (x+y=k) gives perfect 1:1 pricing but breaks the moment one token becomes more valuable because arbitrageurs drain the cheap side completely. Curve's stable-swap invariant blends constant product and constant sum to keep stablecoin pairs near peg while still surviving extreme moves. Balancer generalises the formula to multiple tokens with custom weights. Uniswap V3 keeps x*y=k but only within a price range you choose, dramatically improving capital efficiency. We will get to each of these.
How Swaps and Pricing Work: A Worked Example
Numbers make this concrete. Imagine a brand new ETH/USDC pool seeded with 10 ETH and 30,000 USDC. The reserves give us k = 10 * 30,000 = 300,000. The starting price of ETH is 30,000 / 10 = 3,000 USDC. A trader wants to buy 1 ETH. What happens?
Two things should jump out. First, the trader paid 3,333 USDC for 1 ETH even though the pool was quoting 3,000 at the start. That difference is slippage, the price impact of moving along the curve. Second, the new marginal price jumped to 3,703 USDC per ETH because reserves are now lopsided. Arbitrageurs will spot this and rebalance the pool by selling ETH back into it until the marginal price matches the global market, capturing the gap as profit. This arbitrage loop is what keeps AMM prices honest with the rest of the market.
The 0.3% fee on the input is the LP's reward for providing capital. It is added to the pool reserves, increasing k slightly with every trade. Over millions of swaps, those fees compound and accrue to the LPs proportionally to their share of the pool.
Liquidity Providers and LP Tokens
An AMM cannot function without somebody depositing the underlying tokens. That somebody is the liquidity provider. When you provide liquidity to a constant product pool, you must deposit both sides in the current ratio. For our example pool you would have to deposit ETH and USDC at the 1:3,000 ratio. Deposit 1 ETH and 3,000 USDC, and the contract mints you LP tokens representing your proportional share of the pool. The LP token is an ERC-20 you can transfer, burn or stake.
The LP token life cycle is simple. You call addLiquidity on the router, it pulls both tokens, mints LP tokens, sends them to your wallet. Every trade that hits the pool pays a fee that grows the reserves. Your LP tokens still represent the same percentage share, but each token now claims more underlying. When you want to exit you call removeLiquidity, burn the LP tokens, and receive your proportional share of the reserves including all accumulated fees.
The catch is that the composition of your withdrawal will not match the composition of your deposit. If ETH doubled while you were providing liquidity, the pool would have lost ETH and gained USDC through arbitrage rebalancing. You would withdraw less ETH and more USDC than you started with, and the dollar value of that withdrawal would be lower than if you had simply held the original tokens. That gap is called impermanent loss, and it is the single most important concept for any LP to understand before depositing a single dollar.

Types of AMMs
Not all AMMs are the same. Different invariants are optimised for different asset profiles. Four families dominate the landscape in 2026.
The original x*y=k curve. Liquidity spread across all prices from zero to infinity. Simple, robust, but capital inefficient for stable pairs.
Hybrid of constant sum and constant product. Near-flat curve around the 1:1 peg, then steepens. Perfect for USDC/USDT or stETH/ETH pairs.
LPs pick a price range. Capital is active only inside that range, multiplying effective depth by 100x or more. Active management required.
Generalised constant product across N tokens with custom weights like 80/20 or 60/20/20. Works as a self-rebalancing onchain index fund.
Constant sum is a fifth family worth mentioning but is rarely deployed alone because it cannot survive price divergence. Mooniswap and a handful of others experimented with virtual balances and delayed pricing to defeat MEV. mStable used a constant sum core for stable pairs. In 2026 most production deployments fall into the four boxes above.
Concentrated Liquidity Explained
Uniswap V3, launched in May 2021, was the most important AMM upgrade since V1. The insight was that for any specific pair, almost all trading happens within a narrow band around the current price. Liquidity spread across all prices from zero to infinity is mostly wasted. V3 lets each LP choose a custom price range and concentrates their capital inside it. Inside the range they behave like a normal constant product pool, just with a much higher effective k. Outside the range, their capital sits idle and earns no fees.
The pool's price space is divided into discrete tick increments, each representing a 0.01% price step. LPs deposit liquidity between a lower tick and an upper tick. The protocol exposes multiple fee tier options, typically 0.01%, 0.05%, 0.30% and 1%, so LPs can pick a fee that matches the volatility of their pair. Stablecoin pairs use the 0.01% or 0.05% tier. Volatile small caps use the 1% tier.
Capital efficiency gains are dramatic. A V3 LP can match the slippage of a V2 LP using one to several hundred times less capital, depending on how tight the range is. The trade-off is that V3 positions are non-fungible (each one is an ERC-721 NFT) and require active management. If the price drifts out of your chosen range, your position stops earning fees and converts entirely to the worse-performing asset, which is essentially maximum impermanent loss for that range.
Uniswap V4, deployed in early 2025, builds on V3 with hooks. Hooks are external smart contracts that can plug into a pool's lifecycle events like before-swap, after-swap, before-add-liquidity and so on. This unlocks limit orders, dynamic fees, MEV-protected pools, custom oracle integrations and a hundred other patterns that previously needed their own protocol.
Stable-Swap Pools
Stablecoins are supposed to trade at one dollar each. So are wrapped Bitcoin variants like WBTC and tBTC. Pairs like stETH/ETH should trade near one because they represent claims on the same underlying. If you tried to host these pairs on a constant product AMM, the curve would still produce slippage even when both sides are essentially equivalent. That is wasted slippage.
Curve, launched in 2020 by Michael Egorov, solved this with the stable-swap invariant. The full equation is more complex, but the intuition is that the curve behaves almost like constant sum near the 1:1 peg, giving microscopic slippage for trades that stay close to balance. As reserves drift far from the peg the curve transitions into something that looks like constant product, which prevents anyone from draining the pool when the pair genuinely depegs.
For a USDC/USDT pool with ten million on each side, a constant product AMM might give you 0.3% slippage on a one million dollar swap. The same swap on a Curve stable-swap pool might give you 0.01% slippage. This is why Curve became the dominant venue for stablecoin trading and the backbone of the DeFi yield economy. Most large stablecoin trades route through Curve, and lending protocols, yield aggregators and stablecoin issuers depend on its liquidity.
Risks for Liquidity Providers
Being an LP looks like passive income on the surface. Deposit two tokens, collect fees, withdraw whenever. The reality is more nuanced. Four major risks deserve serious thought before depositing a single dollar.
Impermanent loss is the gap between holding both tokens and providing liquidity with them. It arises any time the price ratio of the two tokens diverges. The bigger the move, the bigger the loss. A 2x price move produces about 5.7% impermanent loss. A 5x move produces 25.5%. The loss is impermanent only if the price returns to the original ratio. If the move is permanent, so is the loss. Read our deep dive on impermanent loss before committing capital to volatile pairs.
MEV and sandwich attacks are the second risk. Searchers running bots monitor the mempool for large incoming swaps. When they spot one, they front-run it by buying the same asset, let the victim's swap push the price up, then sell into the higher price. The victim pays excess slippage that flows to the bot. LPs are not directly sandwiched, but LP fees are diluted because some of the profit that should accrue to the pool gets captured by searchers instead. Read more about MEV and sandwich attacks to understand the dynamic.
Smart contract risk is the third. AMM contracts are usually well audited, but they are still software running on a public blockchain holding billions of dollars. Bugs do happen. Cream, Beanstalk, Mango and dozens of other protocols have been drained by exploits. Even a well-audited AMM can interact unpredictably with a malicious or buggy token contract, especially with the rebase tokens and fee-on-transfer tokens that some projects deploy.
Divergence loss in concentrated liquidity is the fourth and most acute. If you provide liquidity in a tight range on Uniswap V3 and the price exits the range, your position converts entirely to the cheaper asset. You hold 100% of the side that depreciated. If the price keeps moving away from your range, you keep holding the loser. Active LPs need to rebalance ranges or accept that their fees must outpace this divergence.
Risks for Traders
Traders face their own set of AMM-specific risks. The first and biggest is slippage. As shown in the worked example, moving along an AMM curve produces a price impact that scales non-linearly with trade size. Buying 0.1 ETH from a deep pool is essentially free. Buying 10% of the ETH reserve might cost 10% slippage. Every modern AMM frontend lets you set a maximum acceptable slippage tolerance. If the realised slippage at execution time exceeds that tolerance, the transaction reverts and you pay gas but get nothing.
The second risk is low liquidity. A newly launched token with a thin pool can have such shallow reserves that a 500 dollar trade moves the price 30% or more. Snipers and bots routinely create traps where they seed a pool with just enough liquidity to look legitimate, then drain it the moment retail starts buying. Always check the liquidity depth and lock status before swapping into a new token. Our Uniswap tutorial covers the liquidity-check workflow in detail.
The third risk is sandwich attacks. The same MEV bots that erode LP fees feast on retail traders who set high slippage tolerance. If you set 5% slippage on a 50,000 dollar swap, a searcher will gladly extract 5% of that as profit. Setting slippage tolerance correctly is one of the most underrated trader skills in DeFi. Use the lowest tolerance the trade will accept, route through MEV-protected RPCs like Flashbots Protect or use private orderflow services like CowSwap.
AMM Aggregators and Routing
You rarely want to trade directly on a single AMM. Liquidity is fragmented across dozens of pools on dozens of chains. The same pair might exist on Uniswap V3, Uniswap V4, SushiSwap, Curve, Balancer and a dozen smaller venues. The optimal route might split your trade across three of them to minimize price impact. Doing this by hand is impossible. That is why DEX aggregators exist.
1inch was the original aggregator and still routes billions in monthly volume. It splits large orders across many AMMs and chains to find the best execution. 0x Matcha and 0x API offer the same service with a strong focus on professional and institutional users. ParaSwap runs sophisticated routing algorithms across hundreds of pools. CowSwap (CoW Protocol) takes a different approach by batching user orders together so that traders who want the opposite sides of the same trade can match peer to peer at the same uniform clearing price, eliminating MEV by design and only falling back to AMMs for the residual.
For any trade larger than a few thousand dollars, an aggregator will almost always give you better execution than going directly to a single AMM. The cost is one extra hop and a small protocol fee, usually a fraction of the slippage saved.
Top AMMs in 2026

The market leader. Concentrated liquidity, hooks ecosystem, deepest pools for almost every major pair.
Stable-swap pioneer. Backbone of stablecoin trading and liquid staking token markets.
Custom-weight pools and managed AMMs. Strong fit for treasuries and onchain index strategies.
Dominant retail AMM outside Ethereum. V3 concentrated liquidity plus aggressive incentive programs.
Leading Solana AMM. Hybrid CLMM and constant product pools, deeply integrated with the Solana DEX stack.
Veteran multi-chain AMM. V3 deployment plus the Trident framework for custom pool types.
Newer venues like Aerodrome on Base, Velodrome on Optimism, Camelot on Arbitrum and Orca on Solana have carved out important regional roles. Aerodrome in particular has become the de facto liquidity hub on Base, with a ve(3,3) tokenomics model inherited from Solidly that lets vote-escrowed token holders direct emissions toward the pools they want to deepen. Hyperliquid and Drift sit slightly outside this list because their core product is perpetuals on order books, but both run AMM-style spot venues as well.
Market share among these venues shifts month by month as incentive programs, new chain launches and L2 narratives ebb and flow. What stays remarkably stable is the share concentrated at the top. The largest five or six AMMs typically capture more than 80% of total onchain spot volume, with Uniswap alone often above 50%. Network effects in AMM liquidity are powerful. Deeper pools attract more swaps, more swaps generate more fees, more fees attract more LPs, and the deeper pools attract more swaps. Breaking that flywheel is exactly what newer entrants attempt to do with custom incentive emissions and chain-specific exclusivity deals.
If you trade across multiple chains, it is worth checking aggregator dashboards like DefiLlama and Dune to see which venues actually have depth on the pair you care about. The right AMM for a USDC/ETH swap on Arbitrum is not necessarily the right AMM for a long-tail meme token on Solana. Liquidity is fragmented and you should route to where the depth is, not where the brand is loudest.
The Future of AMMs
AMM design is still actively evolving. Three threads are worth watching closely through the rest of the decade.
The first is the Uniswap V4 hooks ecosystem. Hooks turn the AMM from a closed product into a programmable substrate. Developers are shipping hooks for limit orders, time-weighted average market makers, MEV-protected pools, dynamic fees that respond to volatility, KYC-gated pools for institutions, and custom oracle bindings. Over the next few years many features that used to require entire standalone protocols will become hooks on top of a single shared liquidity layer.
The second is intent-based trading. CowSwap pioneered the idea that users should express what they want (an outcome) rather than how to achieve it (a route through specific pools). Solvers compete to deliver the best outcome and capture MEV inside the auction rather than letting it leak to sandwichers. UniswapX, 1inch Fusion and similar systems are converging on the same intent model. AMMs become the fallback execution layer rather than the front-facing trading interface.
The third is MEV-resistant AMM design. Cow Protocol, McSwap, Flashbots Protect, MEV Blocker, FastLane and dozens of other projects attack different parts of the MEV stack. New AMM designs include batch auctions that clear at a single uniform price, function-maximising market makers, and oracle-bound AMMs that quote against external prices to neutralise sandwich attacks. The endgame is an AMM where retail traders no longer leak value to searchers and LPs no longer pay the hidden MEV tax on their fees.
A fourth thread, less hyped but quietly important, is cross-chain AMM design. Today most AMMs operate on a single chain. If you want to swap from ETH on Ethereum to SOL on Solana, you typically bridge first, then swap on the destination chain. Projects like THORChain, Maya Protocol, Squid and LI.FI have spent years iterating on AMMs that hold reserves natively on multiple chains and quote a single cross-chain price. As bridging primitives mature and shared sequencing networks come online, expect cross-chain AMMs to absorb more of the bridging flow that today sits behind dedicated bridge protocols.
Finally, expect AMMs and lending protocols to converge. Morpho Blue, Euler V2 and other modular lending venues already use AMM-style oracles for liquidations. The reverse direction, AMM pools that natively support leveraged LPing and onchain margin without a separate lending hop, is being explored by Panoptic, Gammaswap and several others. The line between providing liquidity and lending capital is blurring, which is exactly the kind of composability that made DeFi interesting in the first place.
Frequently Asked Questions
What is the difference between an AMM and a DEX?
A DEX is a decentralized exchange, which is the broad category. An AMM is one specific design of DEX that uses liquidity pools and a pricing formula instead of an order book. All AMMs are DEXs, but not all DEXs are AMMs. Hyperliquid and dYdX, for example, are DEXs that use order books rather than AMMs.
Are AMMs risky for liquidity providers?
Yes. LPs face impermanent loss when token prices diverge, MEV-related fee dilution, smart contract risk, and on concentrated liquidity pools, divergence loss if the price exits their chosen range. Profitable LPing typically requires the trading fee revenue to consistently outpace these costs, which is closer to active market making than passive yield earning.
What is impermanent loss?
Impermanent loss is the difference in value between providing liquidity to an AMM and simply holding the two tokens in your wallet. It arises whenever the price ratio of the pool's tokens changes. A 2x price move produces roughly 5.7% impermanent loss, a 5x move about 25.5%. The loss only becomes permanent if you withdraw while the prices are still diverged.
Why do AMMs use x*y=k?
The constant product invariant guarantees that the pool can never run out of either token. As one reserve shrinks the price climbs asymptotically toward infinity, and as the other grows its price drops toward zero. This produces a continuous quote at any trade size with no manual market maker, which is exactly what permissionless onchain trading needed.
Which is the largest AMM?
Uniswap is the largest AMM by total trading volume, TVL, and active markets. Across V3 and V4 it routinely settles more spot volume than every other DEX combined. Curve is the largest stablecoin-focused AMM, PancakeSwap dominates BNB Chain, and Raydium leads on Solana.
Can anyone create an AMM pool?
Yes. On Uniswap, PancakeSwap, Raydium and most other AMMs, anyone can deploy a new pool for any pair of tokens by depositing the initial liquidity. There is no listing approval and no central gatekeeper. This is what enables the long tail of token launches and is also what makes basic due diligence on liquidity locks and contract safety essential before swapping into any new pool.
Conclusion
Automated market makers replaced order books with code and unlocked permissionless trading for every token on every chain. The trick was a deceptively simple formula, x*y=k, that turned passive liquidity into a continuous pricing function. Over six years that idea has evolved into stable-swap invariants, concentrated liquidity, weighted pools, V4 hooks and the broader intent-based trading stack being built on top.
For traders, AMMs offer instant access to thousands of markets at the cost of slippage and MEV exposure that have to be managed actively. For liquidity providers, AMMs offer fee yield in exchange for impermanent loss and an increasingly demanding game of active range management. For protocol designers, AMMs offer a programmable liquidity layer that keeps absorbing more of what used to be standalone products.
Whether you are routing a swap, providing liquidity, designing a new token launch or building a protocol on top of existing pools, understanding the engine that prices everything onchain is no longer optional. The AMM is, for now, the centre of DeFi.
Related Guides
- What Is a Market Maker in Crypto: Complete Trader Guide (2026)
- What Is Balancer (BAL)? Weighted AMM DEX Protocol Guide 2026
- Aave Protocol Explained: V3, GHO, Risk Modes and How the Market Works (2026)
- Best Meme Coin Launch Tools in 2026: No-Code, Design, Bots and Verification
- Maker vs Taker Fees in Crypto: Complete Beginner Guide (2026)