What Is a DEX (Decentralized Exchange) in Crypto?

You sign every DEX swap yourself, so its slippage limit and deadline decide whether it settles, while the token approval behind it can leave part of your balance exposed afterward.

Topic
DeFi
Level
Beginner
Reading time
12 min
Last updated

Overview

Introduction

Uniswap, Curve, and PancakeSwap let you trade tokens straight from a wallet you control, with no account to open and no deposit to hand over. They're decentralized exchanges (DEXs), and smart contracts or on-chain matching settle every trade on a blockchain.

That control moves the work onto you. The price you get depends on the liquidity behind the quote, and the fill can shift before the transaction settles. A centralized exchange (CEX) takes that work off your hands, but only by holding your funds and settling trades on its own books.

What a DEX Means in Crypto

A DEX differs from a centralized exchange in who holds the keys. On a DEX, your wallet signs every action, and your tokens stay in that wallet until a contract moves them as part of a trade. You still reach the DEX through a website or app, though the interface only builds transactions for you to sign.

DEXs are the trading layer of decentralized finance, the wider set of lending, staking, and trading protocols built on smart contracts. Individual decentralized exchanges differ in the chains they support, their fee tiers, and their pool designs, so the same swap can quote differently on two of them.

Self-custody lowers your exposure to an exchange failing or freezing withdrawals, but it shifts the operational risk to you. If the token you buy is a fake, your slippage tolerance is set too wide, or you approve a malicious spender, no support desk can reverse the transaction once it settles.

How a DEX Swap Executes On-Chain

1. Connect your wallet. Connecting a non-custodial wallet to a DEX interface moves no funds. It lets the app read your balances and build transactions for you to sign.

2. The interface finds a route. On an automated market maker (AMM), it reads pool reserves and fee tiers, and on an order-book DEX it reads resting orders. Some interfaces split one swap across several pools when that returns more tokens, and the liquidity in each pool sets how far your trade moves its price.

3. You approve the token. On Ethereum and similar chains, a DEX contract can move a token from your wallet only after you approve it. Under Ethereum's ERC-20 token standard, that approval covers a set amount, or an unlimited one if the app asks for it. A plain approval, the kind Uniswap v3's router uses, is its own on-chain transaction, and any allowance the swap doesn't use stays open afterward.

Apps built on Uniswap's Permit2 contract need that approval transaction once per token. After that, a signed, time-limited message gives each new spender access without another on-chain approval.

4. You sign the swap. The signed transaction fixes the route, the amount you sell, a deadline, and a minimum output set by your slippage tolerance. Validators then include it in a block, and it executes against pool prices at that moment, which may differ from the prices behind your quote.

5. The contract checks and settles. On Uniswap v3, the router rejects the swap if the deadline has passed or the output falls below your minimum. Either failure reverts the whole transaction, so the tokens you were selling stay in your wallet.

Take a hypothetical sale of 10,000 USD Coin (USDC) through Uniswap v3's router, quoted at 4 ether (ETH) with a 0.5% slippage tolerance, which sets the minimum at 3.98 ETH. If the pool pays 3.99 ETH when the transaction executes, the swap settles. If other trades have pushed the output down to 3.95 ETH by then, it reverts. The 10,000 USDC stays put and the approval from step three remains open, but the network fee for the failed swap is still spent.

A DEX swap settles only if it clears your minimum before the deadline

A hypothetical sale of 10,000 USDC on Uniswap v3 needs an approval, a quote, and a signed swap with a 3.98 ETH minimum and a deadline, and the router reverts any fill that misses either limit.

Slippage tolerance becomes a hard minimum inside the signed swap. A fill below it reverts and leaves your tokens in place, though the network fee and the approval remain.

All swap figures are hypothetical. The contract checks shown are Uniswap v3's, and other DEXs, aggregators, and chains name and enforce limits differently. Apps on Uniswap's Permit2 send the approval transaction once per token and use signed messages after that, native ETH needs no approval, and the gas fee varies with network demand.

AMMs, Order Books, and DEX Aggregators

AMM DEXs hold tokens in liquidity pools and price each trade with a formula. Uniswap and PancakeSwap work this way, and so does Curve, whose stable-swap pools are designed for assets meant to trade near the same price, such as USDC and Tether (USDT). You trade against the pool itself, with no visible counterparty. AMMs can list almost any token pair, though your output depends on how much the pool holds and how far prices move before execution.

Order-book DEXs match posted bids and asks the way centralized exchanges do. dYdX and Hyperliquid use this design for perpetual futures, and their screens show resting orders and the order types you'd expect on a CEX. Fill quality depends on active market makers and on how each protocol matches and settles orders.

Aggregators hold no liquidity of their own. They search several DEXs, route each trade to the best output after fees and price impact, and sometimes split it across pools. 1inch aggregates DEXs on Ethereum and other Ethereum Virtual Machine (EVM) chains, and Jupiter does the same on Solana. Extra hops can improve the price, though each one adds another pool and contract to the path.

A small spot swap in a well-funded pool and a perpetual futures position need different designs. In the table, each design on the left is paired with the trade it suits on the right.

AMM pool

Simple token swaps in a pool with enough liquidity

Stable-swap AMM

Swaps between similar assets, such as stablecoins or wrapped tokens

Order-book DEX

Visible bids and asks, with trading-style order types

Perpetuals DEX

Derivatives exposure, margin, and advanced order tools

DEX aggregator

One quote compared across several liquidity sources

DEX vs. Aggregator vs. Wallet Swap

One swap screen can hide several tools, and each one changes the fees, the route, who you can ask for help, and what can go wrong after you sign. The left column names the tool, and the right describes its part in a swap.

DEX

Smart contracts or on-chain order matching that execute the trade

DEX aggregator

Route search across several DEXs

Wallet swap

A wallet app’s built-in swap, routed through a partner, DEX, or aggregator

Bridge

Asset transfer between chains, before or after a swap

Fiat on-ramp

Card or bank purchase of crypto, before any DEX trade

The label on the screen doesn't always show the full route. A wallet swap may call an aggregator, the aggregator may split the order across several DEX pools, and a cross-chain swap may add a bridge on top. Each extra layer can add its own fee, and on Ethereum and other EVM chains, its own token approval.

DEX vs. CEX by Trading Task

A DEX tends to fit when self-custody and direct protocol access come first. A CEX is the better match when fiat deposits, customer support, and unified statements count for more. Each task on the left is paired with the better fit on the right.

Buy crypto with local currency

CEX

Keep control of your keys while trading

DEX

Get help after an account or transaction problem

CEX

Trade a new small-cap token early

DEX, with fake-token risk

Trade fast in large, liquid markets

Either

Keep clean tax records

CEX

Avoid platform custody risk

DEX, with contract and approval risk

New tokens often reach DEX pools before any CEX lists them, and so do fake copies with thin liquidity behind them. For large, liquid pairs, fast CEX matching and a well-funded pool on a quiet chain can both fill well. Tax records take more work on a DEX, though, since the activity spreads across wallets, chains, and apps with no single statement.

If your first step is buying crypto with a bank card or transfer, Coinbase is one example of the centralized route, with funding built into the account.

DEX Fees, Gas, and Hidden Swap Costs

One swap can pay several of the costs in the left column, and the right column says what each one covers.

Network fee

The gas or chain fee to process the transaction

Trading fee

The cut taken by the pool, protocol, or liquidity source

Price impact

How far your own trade moves the price

Slippage

The gap between the quote and the fill, capped by your tolerance

Wallet or partner fee

Any extra fee from the wallet, app, or routing partner

Bridge fee

The added cost when the route crosses chains

Failed transaction

The network fee, spent even when the swap doesn’t complete

A low trading fee doesn't guarantee a cheap swap, since a pool with more liquidity and less price impact can beat one with a lower fee. On small trades the network fee can outweigh the DEX fee, and on large trades price impact usually becomes the bigger cost.

Where DEX Trades Go Wrong

Many DEX losses come from routine execution errors that compound, with no exploit involved.

Network congestion. A quote can go stale while the transaction waits in the mempool, the queue of unconfirmed transactions. A route that looked fine at submission can degrade as pending transactions stack up, and a low fee setting during congestion can delay confirmation until the market has moved past your quote.

Slippage tolerance. A wide tolerance lets a poor fill go through, while a tight one causes more failed transactions when prices swing. No single setting suits every pair or every hour.

MEV exposure. Swaps waiting in a public mempool are visible to searchers chasing maximal extractable value (MEV). They can place their own transactions just before and after yours, especially on thinner pairs. Private transaction routing can reduce this on some routes, though support varies across chains and apps.

Token approvals. Unlimited approvals save repeat prompts but leave spending permissions open indefinitely. If a contract, interface, or dependency is compromised later, a large approval raises the loss. Guarding your private key covers only part of wallet security, so the permissions you've granted need checking too.

Cross-chain mismatches. The same ticker on two networks doesn't always mean the same asset. USDC on Ethereum and USDC on another chain move between each other only through a valid bridge path, and the destination app has to support that version of the token.

Thin liquidity. A trade that looks modest in dollar terms can still move the price sharply when a pool is small or its liquidity is concentrated in a narrow price range.

How to Read a DEX Quote Before You Sign

A DEX quote sets execution limits as well as a price. If you check only the output token and skip the route details, you can approve a trade that costs more than expected or fails during settlement. Each quote field on the left is paired with what it tells you.

You pay

Input token, amount, and chain

You receive

Estimated output before execution

Minimum received

Worst output you accept after slippage

Price impact

Whether the trade is too large for the available liquidity

Route

One pool, several pools, or an aggregator path

Network fee

Chain cost before the swap is broadcast

Approval request

Which contract can spend the token, and how much

Transaction deadline

How long the quote stays valid before the swap fails

If the minimum received looks too low, don't rely on the estimate above it. Cut the trade size, compare another route, or wait for more liquidity.

Why a DEX Swap Can Fail but Still Cost Money

Ethereum charges gas whether a transaction succeeds or fails, so once validators process a swap that reverts at the minimum-received check, its network fee is spent even though no tokens change hands.

Reverts happen when the trade's conditions no longer hold at execution. The price may have moved past your slippage limit, the route may have lost liquidity, or the deadline may have passed while the chain was congested.

Resubmitting the same transaction tends to fail the same way, so check these first.

  1. Confirm the failed transaction on a block explorer.
  2. Check whether only the network fee was spent.
  3. Read the failure reason if the explorer shows one.
  4. Compare the route again before resubmitting.
  5. Lower the trade size if price impact is high.
  6. Leave slippage where it is unless you know why the swap failed.
  7. Keep enough of the native gas token for one retry and one approval change.

A failed swap costs a fee, though it can also save you from a worse fill. If swaps on one token keep failing, the cause may be thin liquidity, a bad route, or a token that's hard to sell.

How to Spot a Token You May Not Be Able to Sell

Some tokens are easy to buy and hard or impossible to sell. Fake tokens, some new memecoins, and tokens whose contracts keep risky permissions for the team can all end up this way, especially in low-liquidity markets.

A wallet balance doesn't prove there's an exit. In the table, each warning sign on the left comes with what it means in practice.

Very low sell liquidity

A value on screen with tiny or impossible exits

Huge price impact

Selling moves the price too far for a normal fill

Unverified contract

A possible copy, fake, or unsafe contract

Mintable supply

New tokens can be created after you buy

Freeze or blacklist controls

Transfers or sales can be blocked

No reliable market history

A price set by thin or manipulated trading

Only one tiny pool

One fragile source of liquidity

For an unfamiliar token, test the sell route with a small amount before adding to the position.

How to Evaluate a DEX Before First Use

A first DEX trade can go wrong before anything is signed, at the domain, the token contract, or the network you pick.

  1. Check the interface. Phishing sites copy DEX layouts exactly, so use the protocol's official domain and bookmark it.
  2. Confirm the token. Match its contract address to an official source.
  3. Confirm the network. Your wallet, the token, and the protocol need to be on the same chain, and any bridge route needs checking before you switch.
  4. Compare routes. Review the direct DEX output and an aggregator's output before you sign.
  5. Add up the costs. Weigh the protocol fee, network fee, price impact, and expected slippage together.
  6. Limit approvals. Approve an amount close to the trade size where the app allows it.
  7. Revoke afterward. Remove approvals you no longer need once a one-off trade is done.

Before your first sizable trade, set up one of the crypto wallets that supports your chain and test its backup.

How to Use a DEX (Decentralized Exchange)

Keep a first DEX trade narrow. Make one small test swap on a high-liquidity pair and review it on a block explorer before repeating at a larger size.

If you still need to buy crypto with cash, one of the centralized crypto exchanges can handle that step before you withdraw to your wallet. After that, save the transaction hash of every swap, which lets you rebuild its date, amounts, and dollar value when you file taxes.

FAQs

Is Coinbase a DEX or CEX?

Coinbase is a CEX. Its exchange uses company-controlled accounts and custodial balances, and while Coinbase also offers some on-chain tools, the core exchange stays centralized.

Which is better, CEX or DEX?

Neither wins every time, because the answer changes with the trade. Many traders keep a CEX account for cash deposits and withdrawals and a self-custody wallet for on-chain swaps, moving funds between the two as needed.

Can I buy crypto with fiat on a DEX?

Usually not directly. Some DEX apps embed a third-party on-ramp for card or bank purchases, and that provider handles the payment and any identity checks. Otherwise, buy on a CEX first and withdraw to your wallet.

Are DEX trades taxable?

In many jurisdictions, yes. In the US, the IRS treats selling or exchanging a digital asset as a disposal, so a token-for-token swap counts even when no dollars come out. For each one, the IRS asks you to keep the type of digital asset, the date and time, the number of units, the fair market value in US dollars, and your basis.

Why do DEX swaps fail?

Common causes include a minimum received that the market moved past, a deadline that expired while the transaction waited, too little gas, the wrong network, or a token path the router doesn’t support. Raising slippage fixes only the first cause, and it also lowers the worst price you accept.

What is a DEX aggregator?

A DEX aggregator is a routing layer that compares prices across exchanges and can split one order to improve the net output. On Ethereum and other EVM chains, your token approval goes to the aggregator’s own router contract, a separate permission from any you gave a DEX directly.

Can I stake on a DEX?

Many DEXs let you provide liquidity, farm rewards, or stake the protocol’s own token, which differs from staking ETH, SOL, or another network asset to secure a blockchain. Providing liquidity earns a share of trading fees, though it also brings impermanent loss, smart contract risk, and tax complexity.

Can I use a DEX without KYC?

Often yes at the protocol level, since many DEX contracts have no account registration and no know your customer (KYC) step. Front ends can still block regions, add compliance checks, or restrict certain routes, and tax rules apply even when no platform collects your identity documents.

Why does my wallet show a token value if I cannot sell it?

The wallet prices the token from recent trades or a price feed, and a few small trades in a thin pool can set that figure. The number says nothing about whether the contract lets you transfer the token or whether any buyer exists at that price.

Is a wallet swap the same as using a DEX?

Not always. A wallet swap can fill from a market maker’s quote with no DEX pool involved, or pass through a third-party partner. The wallet may also add its own fee on top of the route.

Should I use a DEX aggregator or a DEX directly?

Use an aggregator to compare routes across several liquidity sources. Go direct when you already know the pool, fee tier, and route you want, which also keeps down the number of contracts you approve.

Do I need ETH, SOL, BNB, or another gas token to use a DEX?

Usually yes. ETH pays gas on Ethereum mainnet, SOL on Solana, and BNB on BNB Chain, so a wallet holding only the token you want to swap can’t send the transaction. Some apps cover gas on certain swaps, on their own terms.

Can a DEX support team recover my funds?

Usually no. A DEX front end may offer help articles or community support, with no power over a settled transaction. If an approval was abused, revoke it and move what’s left to a new wallet, since funds already taken or sent to the wrong chain are rarely recovered.