A decentralized exchange (DEX) is a trading venue that runs as smart contracts on a blockchain. You trade from your own wallet, and the contracts carry out the swap instead of a company’s matching system. Most DEXs set prices with a formula and a pool of tokens, while a few run an order book on the chain itself.

Quick answer On a DEX you swap one token for another without handing your coins to an exchange first. In the most common design, an automated market maker, you trade against a pool of two tokens, and the pool’s formula sets the price. Bigger trades move the price more. People who fill the pool earn fees and carry their own risks. Anyone can usually create a market, so check the exact token before you sign.

How a DEX differs from a centralized exchange

On a centralized exchange you deposit coins with the company, and it matches trades in its own system. Ethereum.org’s DeFi guide describes the difference this way: on a DEX you never give up control of your assets, and the market runs around the clock because the technology guarantees there is always something to trade against.

In practice, you connect a wallet, approve a swap, and the transaction settles on the blockchain like any other transaction. The wallet holds your coins before and after. Because the swap is a smart contract call, the network’s usual transaction fee applies.

Two designs: pools and order books

Automated market maker (AMM). Instead of matching a buyer with a seller, an AMM keeps a liquidity pool of two assets. Uniswap’s documentation explains that a trader swaps against the pool’s reserves and the pool prices tokens with a constant product formula, x * y = k. Here x and y are the amounts of each token in the pool, and k must stay the same or grow after every trade. The practical result: the larger your trade is relative to the pool, the further it moves the price. Uniswap calls that price impact.

On-chain order book. Some DEXs post buy and sell orders on the chain. Hyperliquid’s documentation says its order book works essentially the same way as centralized exchanges but is fully on-chain, with orders matched by price and then by time.

A worked example

Take an imaginary pool with 100 ETH and 300,000 USDC. That makes k = 30,000,000 and a quoted price of $3,000 per ETH. The pool charges a 0.30% fee, the flat rate Uniswap lists for every v2 pool. The numbers below are for illustration, not real market prices.

You swap You receive Average price paid Above the quoted price
300 USDC 0.0996 ETH $3,012.03 0.4%
3,000 USDC 0.9872 ETH $3,039.03 1.3%
30,000 USDC 9.0661 ETH $3,309.03 10.3%

The first row is mostly the fee. The last row shows the formula at work: a trade worth a tenth of the pool costs about 10% more than the quoted price. Newer Uniswap versions apply the formula within price ranges chosen by liquidity providers, so real pools behave differently, but the direction is the same.

Who puts money in the pool

The tokens come from liquidity providers, who deposit both assets and earn the swap fees. Fees depend on the pool: Uniswap’s fee documentation says v2 pools charge a flat 0.30%, v3 offers tiers of 0.05%, 0.30% and 1%, and in v4 a pool’s creator can set any fee from 0% to 100%.

Providing liquidity is not risk free. Uniswap’s documentation on impermanent loss shows that when the price of one token doubles, a provider ends up with 5.7% less than if they had simply held both tokens, and 13.4% less when it triples, before counting fees.

Who decides which tokens trade

On many DEXs, nobody does. Uniswap’s documentation states that anyone can swap, provide liquidity or create new markets at will, and that no party can pause its core contracts or reverse a trade. The same openness means a pool can exist for a token that only copies a well-known name, so confirm the contract address from the issuer’s own page, as described in why the same token can exist on several networks.

Not every DEX is open to everyone. On November 23, OKXICE opened a venue for tokenized U.S. stocks that trades through Uniswap v4 pools on OKX’s X Layer network. OKX says smart contracts restrict trading and liquidity provision to eligible wallets, and customers must complete identity verification first. The technology can run with or without gatekeepers.

Before you trade on one

  1. Take the token’s contract address from the issuer or project, never from a search result or a message.
  2. Check the price impact the interface shows against the size of the pool. A small pool turns an ordinary trade into an expensive one.
  3. Check the network. The same ticker on another chain is a different token.
  4. Remember that a swap cannot be undone once it settles, so check the amount before you confirm.