Crypto Basics

What Is a Crypto DEX? How Decentralized Exchanges Work and How to Swap

In a nutshell: A crypto DEX (decentralized exchange) is an app built from smart contracts that lets you swap one token for another straight from your own wallet, with no company holding your funds. Most DEXs use liquidity pools and a pricing formula instead of an order book. You pay a network (gas) fee plus a small swap fee, and you take on risks like slippage, fake tokens and smart-contract bugs. Educational only; not financial advice.

Last updated: October 20, 2026.

A crypto DEX, short for decentralized exchange, is a place to trade crypto where the “exchange” is code running on a blockchain rather than a company. You don’t open an account or deposit money with anyone. You connect a self-custody wallet, pick two tokens, approve the trade in your wallet, and the smart contract settles it on-chain in one transaction.

DEXs are a core building block of decentralized finance (DeFi). This guide explains how they work under the hood, shows real examples with live data, walks through a swap step by step, and covers costs, risks and US and Canadian tax basics.

Crypto DEX guide showing an ETH to USDC swap card connected to a liquidity pool with the x times y equals k formula, NutshellCrypto logo

What Is a Crypto DEX?

A DEX is a set of smart contracts that hold tokens and swap them by fixed rules. Ethereum.org’s DeFi overview puts it simply: DEXs let you trade different tokens whenever you want, and you never give up control of your assets. Anyone with a compatible wallet can use them 24/7, and every trade is recorded on the public blockchain.

Key points for beginners:

  • You keep custody. Your tokens stay in your wallet until the moment of the swap, and the output lands back in the same wallet.
  • Crypto in, crypto out. Most DEXs swap tokens for other tokens. To turn dollars into crypto you usually still need an exchange or an on-ramp first.
  • Each DEX lives on a chain. Uniswap runs on Ethereum and many other networks, PancakeSwap is best known on BNB Chain, and Raydium and Jupiter run on Solana. You need that chain’s token (ETH, BNB, SOL) to pay network fees.
  • Anyone can list a token, so scam and copycat tokens are common.

DEX vs Centralized Exchange (Quick Version)

A centralized exchange (CEX) such as Coinbase or Kraken holds your crypto for you, runs an order book on its own servers, and usually requires identity checks. A DEX keeps your funds in your wallet, settles trades on-chain and usually asks for no account at all. The trade-off: there is no customer support or password reset if you make a mistake.

CEX DEX
Who holds your crypto The exchange You, in your wallet
Dollar deposits Yes Mostly no
Main risk Company failure or freeze Your own mistakes, scam tokens, contract bugs

For the full side-by-side breakdown, see our CEX vs DEX comparison.

How DEXs Work: Liquidity Pools and AMMs

Most DEXs are automated market makers (AMMs). Instead of matching a buyer with a seller, an AMM keeps a liquidity pool: a smart contract holding two tokens, for example ETH and USDC. When you swap, you trade against that pool. You put one token in and take the other out, and a formula sets the price.

The money in the pool comes from liquidity providers (LPs), who deposit both tokens and earn a share of the swap fees. Uniswap’s documentation on how Uniswap works describes exactly this setup: liquidity providers fund the pools, and traders swap against the pools’ reserves.

What follows from this design:

  • There’s always a price. You can trade even when no other trader is online.
  • Deep pools give better prices. The bigger the pool compared with your trade, the less your trade moves the price.
  • Arbitrage keeps prices in line. If a pool drifts from the wider market, traders buy the cheap side until it lines up again.

Some AMMs are tuned for specific pairs. Curve, for example, is built for swapping assets that should trade near the same price, such as two dollar stablecoins; DefiLlama’s Curve DEX page describes it as designed for efficient stablecoin trading. That’s why stablecoin swaps on Curve-style pools can have very low price impact. If you’re new to stablecoins, start with our explainer on what stablecoins are and how they hold their value.

The Constant-Product Formula in Plain Words

The classic AMM formula, used by Uniswap and many copies of it, is x × y = k. Uniswap’s docs explain that x and y are the pool’s balances of the two tokens and k is a value that must stay constant (or grow) after every trade.

In plain words: when you add some of one token, the pool must give out enough of the other token to keep the product the same. The more of a token you take out, the scarcer it gets in the pool, and the more expensive each extra unit becomes.

A simple made-up example (numbers chosen for easy math, not real prices):

  1. A pool holds 10 ETH and 40,000 USDC. So k = 10 × 40,000 = 400,000, and the pool’s price is 4,000 USDC per ETH.
  2. You sell 1 ETH. The pool now has 11 ETH, so it must keep 400,000 ÷ 11 ≈ 36,364 USDC.
  3. You receive about 40,000 − 36,364 = 3,636 USDC (a bit less after the swap fee), not 4,000.

That gap of roughly 9% is price impact: your trade was large compared with the pool. In a pool with 1,000 ETH and 4 million USDC, the same 1 ETH sale would move the price by only about 0.1%. Uniswap’s docs make the same point: larger trades relative to pool depth move the price more.

Newer designs, like Uniswap v3’s concentrated liquidity (LPs pick a price range), refine this, but the core idea of trading against pooled reserves stays the same.

Order-Book DEXs and Aggregators

Order-book DEXs

Not every DEX uses pools. An order-book DEX works like a traditional exchange, with buyers and sellers posting limit orders at specific prices, but the order book itself lives on a blockchain. Hyperliquid is a well-known example: its order book documentation says it works essentially the same way as centralized exchanges but is fully on-chain, with orders matched in price-time priority. Order books need fast, cheap blockchains to work well.

DEX aggregators

A DEX aggregator doesn’t hold liquidity itself. It checks many DEXs and pools at once and routes your trade, sometimes splitting it across several pools, to get the best total output. Jupiter is the main aggregator on Solana; its developer docs describe it as the liquidity infrastructure behind the majority of DeFi on Solana. Many wallets build an aggregator into their “swap” button.

DEX Examples and Numbers

The figures below come from the DefiLlama DEX dashboard and its public API (api.llama.fi), checked on October 20, 2026 at about 4:30 PM PKT. Volumes and TVL (total value locked) change every day. This table is listed alphabetically and is not a ranking or a recommendation.

DEX Type Main chains 30-day volume TVL
Curve AMM tuned for stablecoins and similar assets Ethereum and others About $2.7 billion About $1.29 billion
Hyperliquid (spot) On-chain order book Hyperliquid L1 About $4.1 billion (spot only) n/a (most activity is perpetual futures)
Jupiter Aggregator Solana About $13.2 billion (aggregator) n/a (routes to other DEXs)
PancakeSwap AMM BNB Chain and others About $23.7 billion About $2.38 billion
Raydium AMM Solana About $7.3 billion About $1.17 billion
Uniswap (all versions) AMM Ethereum, Base, Arbitrum and others About $71.2 billion About $4.18 billion

For scale: at the same check, protocols DefiLlama classifies as DEXs handled about $6.3 billion in the past 24 hours and about $233 billion over 30 days, while DEX aggregators routed about $70 billion over 30 days. Aggregator volume overlaps with DEX volume, because aggregators send trades to the same pools.

How to Swap on a DEX Step by Step

Here’s the general process. Button names differ between apps, but the steps are the same on most DEXs.

  1. Set up a self-custody wallet. Use a wallet that supports the chain you want, such as MetaMask or Rabby for Ethereum-style chains, or Phantom for Solana. Write your recovery phrase on paper and never type it into a website. Our guide to choosing and using a DeFi wallet covers setup and security.
  2. Fund it with the chain’s gas token. Buy ETH, SOL or BNB on an exchange and withdraw it to your wallet on the correct network.
  3. Open the real DEX site. Type the address yourself or use a saved bookmark. Don’t click links from search ads, DMs or social replies; fake front-ends are a common trap (more on that below).
  4. Connect your wallet and make sure the DEX and your wallet are on the same network.
  5. Choose the tokens. Pick what you’re paying with and what you want. For anything other than the biggest tokens, paste the contract address from the project’s official site or a block explorer instead of searching by name, because anyone can create a token called “USDC.”
  6. Check the quote. Look at the expected output, price impact, the fee, the route and the minimum received. If the price impact is high, try a smaller amount.
  7. Set slippage tolerance. This is how far the price can move before the swap cancels. Many apps offer an “auto” setting. Raising it a lot makes you an easier target for front-running.
  8. Approve the token (first time only). On Ethereum-style chains, swapping an ERC-20 token for the first time needs an approval transaction that lets the DEX contract move that token. Approve only the amount you need where your wallet allows it.
  9. Confirm the swap in your wallet. Read what your wallet shows before you sign: the contract, the amounts and the network fee.
  10. Check the result. The new tokens appear once the transaction confirms; you may need to import the token’s contract address so your wallet shows it.

What a DEX Swap Costs

  • Network (gas) fee. Paid to the blockchain, not the DEX. Ethereum.org’s gas and fees page explains that fees rise when the network is busy. Fees on Ethereum mainnet are often higher than on layer 2 networks or Solana.
  • Swap (LP) fee. A percentage of each trade that mostly goes to liquidity providers. Uniswap’s fees documentation says v2 charges 0.30% on every pool, v3’s standard tiers are 0.05%, 0.30% and 1%, and v4 lets each pool set its own fee. Some front-ends add a small interface fee on top.
  • Price impact. How much your own trade moves the pool’s price, as in the example above. It’s large in small pools.
  • Slippage. The difference between the quote and what you actually get, because other trades land before yours. Your slippage setting caps it.

Centralized exchanges price things differently (trading fees, spreads, withdrawal fees). Our breakdown of crypto exchange fees covers that side.

Risks of Using a DEX

Smart-contract bugs and hacks

A DEX is only as safe as its code. Bugs can let attackers drain pools. In its 2025 stolen-funds report, Chainalysis counted more than $3.4 billion stolen across crypto in 2025. It noted that DeFi hack losses stayed relatively low even as more money returned to DeFi, while attacks shifted toward personal wallets and centralized services. Lower doesn’t mean zero, so newer and unaudited DEXs carry more risk.

Fake tokens and rug pulls

Scammers launch copycats with famous names, or hype a new token and then pull the liquidity (“rug pull”), leaving buyers with something they can’t sell. Verify contract addresses, and be wary of tokens with tiny liquidity or a few wallets holding most of the supply.

MEV and front-running

Pending transactions are often visible before they’re confirmed. Ethereum.org’s MEV page describes sandwich trading: a bot buys just before your swap and sells right after it, profiting from the price move your trade causes. You lose the difference, up to your slippage limit. Keeping slippage tight and using wallets or routers with MEV protection helps.

Token approvals

Approvals let a contract move your tokens later. An “unlimited” approval to a contract that’s later hacked, or to a malicious one, can drain that token from your wallet. Ethereum.org’s guide on how to revoke token access shows how to review and cancel old approvals.

Phishing front-ends

Fake DEX websites and fake “airdrop claim” pages copy real ones to trick you into signing a malicious approval or revealing your recovery phrase. The SEC’s Investor.gov has warned about fraudulent crypto trading websites. No real DEX will ever ask for your recovery phrase.

Providing Liquidity and Impermanent Loss

You can also be on the other side of the trade: deposit two tokens into a pool and earn a share of its fees. The main extra risk is impermanent loss. When the prices of the two tokens move apart, the pool’s formula automatically sells the token that’s rising and buys the one that’s falling, so you can end up with less value than if you had just held both tokens. Uniswap’s guide to understanding returns explains this effect. Fees can make up for it, but not always. Providing liquidity is an advanced step, not a beginner one.

Taxes on DEX Swaps (US and Canada)

A token-for-token swap is usually a taxable event. In the US, the IRS’s digital assets page says exchanging a digital asset for another digital asset counts as a disposal you must report, and the gain or loss on the token you gave up is generally a capital gain or loss. In Canada, the CRA’s guide to reporting income from crypto-asset transactions says trading one crypto-asset for another is a disposition. A DEX won’t send you a tax form, so keep your own records of each swap’s date, amounts and dollar values; our beginner’s guide to crypto taxes explains the rules in full. This is not tax advice.

FAQ

What does DEX stand for in crypto?

DEX stands for decentralized exchange: a smart-contract app that lets you trade tokens directly from your own wallet without a company holding your funds.

Do I need KYC to use a DEX?

Most DEXs don’t ask for identity checks; you just connect a wallet. The exchange or on-ramp you use to buy your first crypto usually will.

Is a DEX safer than a centralized exchange?

Safer in one way, riskier in others. No company can lose or freeze your funds, but you take on smart-contract risk, scam tokens, phishing and your own mistakes, with no one to undo them.

Why did I get fewer tokens than the quote?

Usually because of price impact (your trade was big compared with the pool) or slippage (the price moved before your transaction confirmed). The “minimum received” figure shows the worst case your swap allowed.

What is a DEX aggregator?

A service that compares prices across many DEXs and routes your trade for the best overall result. Jupiter on Solana is a common example.

Sources

This article is for educational purposes only and is not financial, investment or tax advice.

Get crypto, in a nutshell

A short email when something actually matters. No spam.

By subscribing you agree to our Privacy Policy,