What Is a DEX? Decentralized Exchanges Explained
A DEX, or decentralized exchange, is a crypto exchange that runs as smart contracts on a blockchain instead of a company's servers. You trade from your own wallet, so you keep custody of your funds until the swap executes, and there is usually no account to open. The trade-offs are network fees, price slippage and scam risk.
A DEX is a trading venue made of code. Instead of depositing coins with a company that matches your order, you connect a wallet to a smart contract, sign the trade yourself, and the blockchain settles it. This page covers the main designs, a step-by-step first swap, and the risks that catch beginners.
DEX key facts
| Decentralized exchange (DEX) | |
|---|---|
| Who holds your funds | You, in your own wallet, until a trade executes |
| Account and sign-up | Usually none; you connect a wallet |
| Identity checks | Set by the app or front-end you use, not by the blockchain itself. Check the terms of the specific app. |
| How prices are set | An automated market maker (AMM) pool, or an on-chain order book |
| What you pay | A trading fee, plus the network (gas) fee of the blockchain |
| Main risks | Slippage, malicious token approvals, fake websites, smart-contract bugs, scam tokens |
| Customer support | No central desk that can reverse a transaction |
How does a decentralized exchange work?
Most DEXs use one of two designs.
Automated market makers (AMMs). Traders swap against a liquidity pool, a smart contract holding two or more tokens that other users have deposited. A formula sets the price from the ratio of tokens in the pool, and each swap moves that ratio. Liquidity providers earn a share of trading fees for supplying the tokens. Our guides on how an automated market maker works and how liquidity pools work go deeper. Uniswap and PancakeSwap are well-known examples; see our Uniswap review.
On-chain order books. Buyers and sellers post bids and asks, as on a centralized exchange, but the book and the matching run on a blockchain built for speed. Some of these venues focus on perpetual futures. Hyperliquid is one example, and what a perp DEX is explains the category.
A third group, DEX aggregators, scans several DEXs and splits your order across them to find a better price. See our best DEX aggregators page for what to compare.
How to use a decentralized exchange
Labels differ between apps, but the steps are nearly always the same.
- Set up a wallet. Use a self-custody wallet and write down its seed phrase offline. Anyone with that phrase controls your funds.
- Fund the wallet. Get the tokens you want to trade, plus a small amount of the chain’s gas token (ETH on Ethereum, for example) to pay network fees. Some apps are gasless for part of the flow.
- Open the app from a trusted address. Use a bookmark you made from the project’s official site, not a search ad or a link in a message.
- Connect your wallet. Connecting only shares your public address. It should not ask for your seed phrase.
- Pick the two tokens and an amount. Check the contract address of any token you do not recognize. Anyone can create a token with a familiar name.
- Review the quote. Look at the price impact, the fee, the minimum you will receive and the slippage setting.
- Approve, if asked. The first time you sell a token, the wallet may ask you to approve the app’s contract to spend it. This is a separate transaction from the swap.
- Confirm the swap. Read the wallet prompt before signing. When the transaction confirms, the tokens appear in your wallet.
A worked example: swapping on an AMM pool
The numbers are round and hypothetical. Suppose a pool holds 100 ETH and 300,000 USDC, so one ETH is priced near 3,000 USDC. You want to sell 1 ETH, the pool fee is 0.30%, and the gas fee is $5.
- Fee: 1 ETH × 0.30% = 0.003 ETH, so 0.997 ETH goes into the swap.
- The pool now holds about 100.997 ETH. A simple constant-product pool keeps ETH × USDC fixed at 100 × 300,000 = 30,000,000, so USDC falls to 30,000,000 ÷ 100.997, which is about 297,040.
- You receive about 300,000 − 297,040 = 2,960 USDC.
- Compared with the starting price of 3,000, you got about 1.3% less. Part of that is the fee and the rest is price impact from your trade moving the pool.
- Add the $5 gas fee. Your all-in cost is the shortfall plus gas.
A larger trade in the same pool moves the price more. The same trade in a pool ten times bigger would move it much less. This is why pool size matters.
What can go wrong during a swap
| What you see | Likely cause | What to do |
|---|---|---|
| The transaction fails and you lose the gas | Slippage tolerance was too low for a fast-moving price | Retry with a sensible setting, and avoid very volatile moments |
| You receive far less than expected | A thin pool, or a high slippage setting | Check the price impact on the quote before you sign |
| You cannot sell a token you bought | It may be a honeypot, a scam token built to block selling | Check the contract before you buy, and avoid unknown tokens |
| The wallet asks for an unusual approval | A copied site or a malicious contract | Reject it and check the address |
| The swap is stuck pending | The gas fee was too low and the network is busy | Wait, or use your wallet’s speed-up or cancel option |
DEX vs CEX in short
A centralized exchange (CEX) holds your assets, runs the order book and can help with a lost password. A DEX does none of these things for you. The full comparison is in DEX vs CEX.
Risks to know before you trade
- Slippage. The price can move between the moment you see a quote and the moment your trade executes, especially in small pools. A low slippage tolerance makes trades fail; a high one lets you receive a much worse price. What slippage is explains how to set it.
- Token approvals. An approval lets a contract spend a token from your wallet, and an unlimited approval stays active until you revoke it. Approve only what you need and review old approvals from time to time with a token-approval checker or your wallet’s settings.
- Fake front-ends and phishing. Copycat sites, sponsored search results and fake apps imitate real DEXs. Check the address before you connect, and never type a seed phrase into a website.
- Scam and rug-pull tokens. Anyone can list a token in a pool. Some are built so you can buy but not sell. See what a rug pull is.
- Smart-contract risk. Audits reduce the chance of bugs but do not remove it.
- Leverage. Some DEXs offer leveraged perpetual futures. A move against your position can liquidate it and wipe out your margin. Only trade with money you can afford to lose.
Common questions
Do I need to verify my identity on a DEX?
The blockchain does not require it, but the website or app you use may. Some front-ends block users in certain countries or addresses on sanctions lists. Read the terms of the specific app.
Can a DEX trade be reversed?
No. Once a transaction confirms, it cannot be undone, and there is no support desk to ask. Check the address, token and amount before signing.
Why does a DEX charge a gas fee on top of the trading fee?
The trade is a transaction on the blockchain, and the network charges for processing it. The trading fee goes to liquidity providers or the protocol, and the gas fee goes to the network.
Do I need a lot of money to start on a DEX?
No minimum is set by the blockchain, but network fees are fixed per transaction, so very small trades can lose a large share to fees. Compare the fee with the trade size first.
Is a DEX the same as a DeFi app?
A DEX is one kind of DeFi application. Lending, staking and borrowing protocols are others. See what DeFi is.
Sources
- ethereum.org supports: Decentralized exchanges as a DeFi application: swapping tokens through smart contracts from a self-custody wallet
- ethereum.org supports: Smart contracts are programs stored on a blockchain that run when conditions are met