How Exchanges Work (CEX vs DEX)
Centralized exchanges (CEX) use order books and custody your funds, while decentralized exchanges (DEX) use smart contracts and liquidity pools. You'll learn how each operates and when to use them.
Who Is This For?
- •Users choosing where to trade
- •Beginners who want to understand custody and fee differences
Learning Objectives
- 1.Explain how CEX order books differ from DEX AMMs
- 2.Identify custody and KYC implications of each
- 3.Choose the right venue for speed, liquidity, and control
Centralized Exchanges (CEX)
Centralized exchanges are companies that operate trading platforms. They match buyers and sellers using order books—just like traditional stock exchanges.
Order Book Matching
Buy and sell orders are matched by price and time priority
Custodial
Exchange holds your funds in their wallets until you withdraw
KYC Required
Identity verification needed for most features
📈 Interactive Order Book
An order book shows all buy orders (bids) and sell orders (asks). The exchange matches them automatically:
Popular Centralized Exchanges
Decentralized Exchanges (DEX)
Decentralized exchanges run on smart contracts. Instead of order books, most use Automated Market Makers (AMMs) with liquidity pools.
Liquidity Pools
Users provide liquidity; algorithm sets prices automatically
Non-Custodial
You keep your keys; trade directly from your wallet
On-Chain Gas
Every trade is a blockchain transaction with gas fees
🔄 AMM Liquidity Pool Simulator
AMMs use the formula x × y = k (constant product). Try different trade sizes to see how slippage works:
Popular Decentralized Exchanges
Choosing a Venue
Neither CEX nor DEX is universally better—each has trade-offs. Choose based on your priorities.
⚡ Trade Flow Comparison
🔍 Feature-by-Feature Comparison
Like a bank—you trust them with your assets. They can freeze accounts.
Non-custodial—only you control your wallet. No one can freeze it.
Use CEX When...
- You need fiat on/off ramps
- Trading large volumes with minimal slippage
- You want advanced order types (limit, stop-loss)
- Customer support is important to you
Use DEX When...
- Self-custody is your priority
- Trading tokens not listed on CEXs
- Privacy matters (no KYC)
- Participating in DeFi (staking, LPing)
Common Mistakes & Gotchas
These mistakes can cost you money or access to your funds. Learn from others:
⚠️ Remember: "Not your keys, not your coins." CEXs are convenient but add counterparty risk. Only keep funds on exchanges that you're actively trading.
Knowledge Check
Let's see how well you understand exchange mechanics.
Who holds custody of your funds on a centralized exchange (CEX)?
What pricing model do most decentralized exchanges (DEX) use?
What is a key advantage of trading on a DEX?
What causes 'slippage' on a DEX?
When should you prefer a CEX over a DEX?