Crypto-assets are high-risk and volatile. You could lose all the money you put in. Education only — not financial advice. Risk disclosure

Decentralised exchanges (DEXs) explained

How a decentralised exchange (DEX) lets you swap tokens from your own wallet, how it sets prices without an order book, and the risks to know first.

In this article
  • USD Coin (USDC)
  • Ethereum
One person handing banknotes to another
Photo: “Forex Currency Exchange on White Background” by Images_of_Money, CC BY 2.0, via flickr.com.

Key Takeaways

Quick answer

A decentralised exchange (DEX) is a set of smart contracts that lets you swap one token for another from your own wallet, with no company holding your funds. Prices often come from a formula and a pool of tokens. You keep custody but carry code, slippage and scam-token risk.

  • A decentralised exchange is a set of smart contracts that lets you swap tokens directly from your own wallet.
  • Many DEXs price trades with a formula and a pool of tokens, not an order book run by a company.
  • Large trades move the pool price, so you can receive noticeably less than the price first shown.
  • Bots can place trades around yours, which ethereum.org says leaves sandwiched users with worse execution.
  • Anyone can list a token on many DEXs, so scam tokens and malicious apps are a real risk.

What is a decentralised exchange?

A decentralised exchange is trading software that lives on a blockchain. ethereum.org describes it this way: “Decentralized exchanges (DEXs) let you trade different tokens whenever you want. You never give up control of your assets.”

The technical documentation for Uniswap, one of the best-known DEXs, describes its version 2 as “an automated liquidity protocol powered by a constant product formula and implemented in a system of non-upgradeable smart contracts on the Ethereum blockchain.” In plain English: a program that holds pools of tokens and swaps them using a fixed formula, with no company in the middle of each trade.

DEXs are one building block of decentralised finance (DeFi).

How is a DEX different from a centralised exchange?

A centralised crypto exchange is a company: you deposit funds, it holds them, and it matches your order against other customers’ orders. A DEX works differently.

QuestionCentralised exchangeDEX
Who holds your coins?The platformYou, until the swap executes
How is the price set?Buy and sell orders in an order bookUsually a formula applied to a pool of tokens
Account and identity checks?Usually yesUsually just a wallet connection
Who lists tokens?The platform decidesOn many DEXs, anyone can create a pool
Main extra riskPlatform failure, frozen withdrawalsCode bugs, scam tokens, your own mistakes

The US Securities and Exchange Commission (SEC) warns that people who deposit assets with a crypto platform “might cease to have legal ownership of those assets and might not be able to get those assets back when they want to.” A DEX avoids that particular risk because you never deposit with a company — but it gives you no customer-service desk either.

An electronic currency exchange rate board on a street
Photo: “Currency Exchange” by D-Stanley, CC BY 2.0, via flickr.com.

How does a swap on a DEX work?

Uniswap’s documentation sums up the basic action: “Token swaps in Uniswap are a simple way to trade one ERC-20 token for another.” A typical swap goes like this:

  1. You open the DEX website or app and connect a self-custody wallet.
  2. You choose the token you are paying with and the token you want, and the interface shows an estimated amount out.
  3. For many tokens you first sign an approval, letting the DEX contract move that token from your wallet.
  4. You sign the swap and pay the network fee (gas, on Ethereum). The DEX’s own trading fee is taken from the trade — in Uniswap v2’s case 0.30%, added to the pool.
  5. The smart contract sends your tokens into the pool and the other token back to you in the same transaction.

Network fees can be a large part of the cost on small trades. Our guide to crypto trading fees explains gas.

How does a DEX set prices without an order book?

The Bank for International Settlements (BIS) explains that DEXs work by “matching the counterparties in a transaction through so-called automated market-maker (AMM) protocols.” An AMM is a pool holding two tokens and a rule for how many of one you get for the other.

Uniswap v2’s rule is the constant product formula, x · y = k: the two token balances (x and y) multiplied together must stay the same after every trade. When you add one token to the pool and take the other out, the ratio between them shifts — and that ratio is the price. Our lesson on liquidity pools and AMMs works through the formula in detail.

What stops a DEX price drifting away from the wider market? Uniswap’s documentation says differences between its price and outside prices “create arbitrage opportunities”: traders buy where it is cheap and sell where it is dear until the gap closes.

What is slippage on a DEX?

Because every trade changes the pool’s balance, the price moves while your own trade executes. Bigger trades in smaller pools move it more. This difference between the price you see first and the average price you actually get is usually called price impact or slippage.

Illustrative example (hypothetical numbers, x · y = k, fees ignored): a pool holds 100 ETH and 200,000 USDC, so k = 100 × 200,000 = 20,000,000 and the quoted price is 200,000 ÷ 100 = 2,000 USDC per ETH. You pay in 10,000 USDC. The pool now holds 210,000 USDC, so it must hold 20,000,000 ÷ 210,000 = 95.238 ETH. You receive 100 − 95.238 = 4.762 ETH. Your average price is 10,000 ÷ 4.762 ≈ 2,100 USDC — about 5% worse than the 2,000 first quoted.

DEX interfaces usually let you set a slippage tolerance: the most the price may move before the transaction is cancelled. Setting it very high means accepting a much worse fill.

What is a sandwich attack?

On a public blockchain, pending transactions are visible before they are confirmed. ethereum.org explains that this creates “maximal extractable value” (MEV): “the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block.”

One form hits DEX users directly. In sandwich trading, a bot spots a large pending swap, buys the same token just before it, and sells just after. ethereum.org states: “Users who are sandwiched face increased slippage and worse execution on their trades.” A tight slippage tolerance limits how much a sandwich can take, at the cost of more failed transactions.

What are the risks of using a DEX?

  • Smart-contract risk. The European Securities and Markets Authority (ESMA) warns that “if a protocol becomes large enough, any flaw in its smart contract code is very likely to be found and exploited.”
  • Scam tokens and fake sites. On many DEXs anyone can create a pool, so a token with a famous name may be a copy. ESMA says malicious decentralised applications exist with “no other purpose than to deprive users of their money.” Always check the exact token contract address from an official source, and see our crypto scam red flags.
  • Rug pulls. The SEC alleged in a January 2025 case that holders of liquidity-pool tokens can, absent safeguards, withdraw liquidity and sell into the pool, causing losses to investors — “commonly known in the crypto asset industry as a ‘rug pull.’”
  • Approvals. An approval you signed for a malicious or later-hacked contract can be used to take that token from your wallet.
  • Slippage and MEV. As shown above, you may get noticeably less than the first quote.
  • No recourse. ESMA highlights “the lack of a clearly identifiable responsible party and the absence of a recourse mechanism if things go wrong.” A mistaken swap is final.
  • Regulation. The SEC says “entities and platforms involved in lending or staking crypto assets may be subject to the federal securities laws”, and the UK FCA says its rules will apply to DeFi firms where there is an identifiable controlling entity. Many DEX front-ends are not registered or authorised anywhere.

Blockhorizon is an education site. Nothing here is a recommendation to use any DeFi app, token or staking service.

Frequently asked questions

Do I need to give my name to use a DEX?

Usually not — you connect a wallet rather than open an account. That also means no account-recovery process if you make a mistake or your wallet is compromised.

Why did I receive fewer tokens than the DEX first showed?

Your trade moved the pool price (price impact), other trades may have landed first, and fees were taken. A sandwich attack can make this worse, according to ethereum.org.

Is a DEX cheaper than a centralised exchange?

Not necessarily. You pay the DEX’s trading fee, the network’s gas fee and any price impact. For small trades on a busy network, gas alone can outweigh the rest.

Can a DEX freeze my funds?

A DEX does not hold your funds between trades, so it cannot freeze your wallet. But a website front-end can go offline or block access, and tokens held in a contract are only as safe as its code.

Next lessonLiquidity pools and AMMs →

Article Sources

9 sources

Blockhorizon checks every figure, date and quotation against primary sources: regulators, statistics bodies and original technical documents. Read our editorial policy.

  1. ethereum.org — Decentralized finance (DeFi) (updated 26 Jul 2026) — ethereum.org (accessed 2026-10-02)
  2. BIS Quarterly Review, DeFi risks and the decentralisation illusion (6 Dec 2021) — bis.org (accessed 2026-10-02)
  3. Uniswap v2 docs — How Uniswap works — docs.uniswap.org (accessed 2026-10-02)
  4. Uniswap v2 docs — Swaps — docs.uniswap.org (accessed 2026-10-02)
  5. ethereum.org — Maximal extractable value (MEV) (updated 26 Feb 2026) — ethereum.org (accessed 2026-10-02)
  6. ESMA, Decentralised Finance in the EU: Developments and risks (11 Oct 2023) — esma.europa.eu (accessed 2026-10-02)
  7. SEC Litigation Release No. 26223, SEC v. Eric Zhu (16 Jan 2025) — sec.gov (accessed 2026-10-02)
  8. SEC Investor.gov, Exercise Caution with Crypto Asset Securities (Mar 2023) — investor.gov (accessed 2026-10-02)
  9. UK FCA, Overview of our cryptoassets regime policy statements (30 Jun 2026) — fca.org.uk (accessed 2026-10-02)

One plain-English lesson a week

Short, sourced and risk-first. No hype, no “signals”, no sales pitches.

↑↓ to moveEnter to open