Basics

What is a decentralized exchange (DEX)?

A decentralized exchange (DEX) lets people swap one token for another directly on a blockchain, using software instead of a company. This guide explains what that means, how it differs from a traditional exchange, and what trade-offs come with it.

If you have ever used an app to convert one currency into another, the basic idea of an exchange will feel familiar: you hand over one thing and receive another in return. A decentralized exchange, usually shortened to DEX, does something similar for blockchain tokens — but with an important difference. There is no company in the middle holding your money or deciding when your trade happens. Instead, the swap is carried out by smart contracts: small programs that live on a blockchain and run exactly as they are written.

To understand why that matters, it helps to compare a DEX with the kind of exchange most people meet first.

Centralized exchange vs. decentralized exchange

A centralized exchange (CEX) is run by a company. You create an account, usually verify your identity (a process often called KYC, short for "know your customer"), and deposit funds. From that moment, the company holds your tokens for you. When you place a trade, the exchange matches your order with someone else's inside its own systems, and it records the result in its private database. You are trusting that company to keep your funds safe and to let you withdraw them later.

A decentralized exchange works differently in several ways:

  • Custody: on a CEX, the company holds your funds. On a DEX, your tokens stay in your own wallet until the moment a swap executes. This is called self-custody.
  • Accounts and KYC: a CEX typically requires an account and identity checks. A DEX is software you interact with directly through a wallet; there is no account to sign up for.
  • Who matches trades: a CEX matches buyers and sellers internally. A DEX uses smart contracts to handle the swap automatically, following fixed rules.
  • Where settlement happens: a CEX settles trades inside its own database. A DEX settles on the blockchain itself, in public.
Comparison table: a centralized exchange holds funds, requires accounts and KYC, matches trades internally, and settles in a private database; a decentralized exchange keeps self-custody, needs no account, uses a smart contract to handle swaps, and settles on-chain and irreversibly.
How a centralized exchange and a decentralized exchange differ.

Self-custody and on-chain settlement

Self-custody means you, and only you, control the keys to your wallet. A "key" is a secret string of characters that proves ownership of your tokens. No company can move those tokens for you, but no company can recover them for you either. That control is the appeal of a DEX — and also the responsibility.

When a swap runs on a DEX, it is recorded on-chain: written permanently into the blockchain. On-chain settlement has three qualities worth understanding clearly:

  • Public: anyone can see that a transaction occurred, including the amounts and the wallet addresses involved.
  • Final: once confirmed, a transaction is settled.
  • Irreversible: there is no "undo" button and no support desk to reverse a mistake.

How a DEX replaces the order book

Traditional exchanges keep an order book — a constantly updating list of who wants to buy and sell, and at what price. Many DEXs do away with the order book entirely. Instead, they use an automated market maker (AMM): a smart contract that holds a pool of two tokens and uses a mathematical formula to decide the swap rate, with no human matching orders. This is one of the most important ideas in how DEXs function, and it has its own article. For now, the short version is that a formula and a shared pool of tokens take the place of the buyers and sellers a traditional exchange would line up.

Uniswap as a well-known example

Uniswap is a widely cited example of a DEX. Described plainly, it is a set of smart contracts deployed on Ethereum and several other blockchains. Those contracts let people swap tokens and let others supply tokens to the shared pools the contracts draw on. Because the logic lives in public smart contracts rather than in a company's servers, anyone can inspect how it works. This blog discusses Uniswap independently for educational purposes; it is not affiliated with, endorsed by, or sponsored by Uniswap or Uniswap Labs.

Trade-offs and limitations

Self-custody and on-chain settlement come with real downsides that are easy to overlook:

  • Gas fees: running a transaction on a blockchain costs a fee, sometimes called gas. These fees vary and are charged whether or not the outcome is what you expected.
  • You hold your own keys: if you lose your wallet's secret key or recovery phrase, no one can restore your access.
  • Mistakes are permanent: sending tokens to the wrong address, or approving the wrong transaction, generally cannot be undone.
  • Scam tokens exist: because anyone can create a token and list it, some are deliberately deceptive. A token appearing in a DEX interface is not a sign that it is safe or legitimate.

None of this is meant to alarm you — only to set expectations. A DEX hands you more control and asks for more care in return.

Key takeaways

  • A DEX lets you swap tokens directly on a blockchain through smart contracts, with no company holding your funds.
  • The core differences from a centralized exchange are custody, accounts/KYC, who matches trades, and where settlement happens.
  • On-chain settlement is public, final, and irreversible — there is no undo.
  • Many DEXs, including Uniswap, replace the order book with an automated market maker.
  • The trade-offs include gas fees, full responsibility for your own keys, permanent mistakes, and the existence of scam tokens.

New here? Start with how automated market makers work, or browse the glossary.

Disclaimer: This article is educational content only. It is not investment, financial, legal, or tax advice, and not a recommendation to buy, sell, or trade any asset. Crypto involves significant risk, including total loss of funds.