> For the complete documentation index, see [llms.txt](https://web3-encyclopedia.gitbook.io/web3-encyclopedia/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://web3-encyclopedia.gitbook.io/web3-encyclopedia/decentralized-finance-defi/cex-vs-dex.md).

# CEX vs DEX

<figure><img src="/files/Iab3VXJ9eUVzWsOGLXtY" alt=""><figcaption><p>Source: <a href="https://www.youtube.com/watch?v=xKjR9c9P0UY">https://www.youtube.com/watch?v=xKjR9c9P0UY</a></p></figcaption></figure>

## CEX (Centralized exchange)

Centralized exchanges are platforms that allow users to buy and sell cryptocurrencies for fiat currencies such as the US dollar or digital assets like BTC and ETH. They operate as trustworthy brokers in deals and frequently serve as custodians, keeping and safeguarding your cash.

### Top 10 cryptocurrency exchanges ranked by trust score

<figure><img src="/files/Set1u2t1NVgAy0Bw7Dfm" alt=""><figcaption><p>Source: <a href="https://www.coingecko.com/en/exchanges">https://www.coingecko.com/en/exchanges</a></p></figcaption></figure>

### Pros of centralized exchanges

1. Simple and user-friendly interface, suitable for beginners
2. An added layer of security and trustworthiness
3. Higher liquidity than a DEX

### Cons of centralized exchanges

1. Charges service fees
2. Controlled by a centralized party, so the server can be shut down anytime (in theory)
3. Highly vulnerable to hacking or cybersecurity threats

## DEX (Decentralized exchange)

A decentralized exchange is an alternative to traditional centralized exchanges in which no single entity is in charge of the assets. In contrast to a traditional CEX, smart contracts and decentralized apps are used to automate transactions and trades.

This method is far safer since no security breach is possible, assuming that the smart contract is properly constructed.

### What does decentralized mean in cryptocurrency?

Decentralized crypto exchanges vary from centralized crypto exchanges in that they allow users to keep control of their assets by running their important activities on the blockchain. So, how do decentralized exchanges work? They either run on an AMM (automated market maker) or a traditional order book model.

#### AMM model

1. Liquidity for an asset and its swap pair are pooled in a smart contract. Those who pool funds are eligible to receive the fees generated from the swaps using this pool.
2. When someone makes a swap in the pool, the balance of assets in the pool are automatically rebalanced to 50/50 value, and the price of the tokens change to reflect the new supply.&#x20;
3. When there is not enough liquidity in a pool, and a large swap is made, the trader will run into high slippage issues; meaning the lack of liquidity will result in above-market purchase price.&#x20;

#### Order book model:

1. An **order is placed** by a token owner to swap their assets for another asset offered on DEX. The owner of the token determines the number of units they must sell, the token's price and the time limit for accepting bids for the assets.
2. **Other users can offer bids** by placing a purchase order after the selling order has been made.
3. Once the sellers have chosen the time, both sides evaluate and **execute all of the offers**.

### Top five decentralized exchanges ranked by 24H trading volume

<figure><img src="/files/3qxghrzrKPq5WTRK0HBB" alt=""><figcaption><p>Source: <a href="https://coinmarketcap.com/rankings/exchanges/dex/">https://coinmarketcap.com/rankings/exchanges/dex/</a></p></figcaption></figure>

### Pros of decentralized exchanges

1. Completely private and anonymous
2. No need to transfer assets to a third party
3. Fees are redistributed to liquidity providers, not to a centralized entity

### Cons of decentralized exchanges

1. You can't trade with fiat currencies
2. Risk of impermanent loss for liquidity providers
3. Liquidity can be thin, making it harder to execute large orders

## Summary

<figure><img src="/files/PorURJtvNvRwnOOEVDLJ" alt=""><figcaption><p>Source: <a href="https://www.zenledger.io/blog/decentralized-exchange-vs-centralized-exchange#:~:text=Centralized%20exchanges%20are%20platforms%20that,keeping%20and%20safeguarding%20your%20cash.">https://www.zenledger.io/blog/decentralized-exchange-vs-centralized-exchange#:~:text=Centralized%20exchanges%20are%20platforms%20that,keeping%20and%20safeguarding%20your%20cash.</a></p></figcaption></figure>

<details>

<summary>Sources</summary>

<https://www.youtube.com/watch?v=xKjR9c9P0UY>

<https://www.zenledger.io/blog/decentralized-exchange-vs-centralized-exchange#:~:text=Centralized%20exchanges%20are%20platforms%20that,keeping%20and%20safeguarding%20your%20cash.>

[https://www.coingecko.com](https://www.coingecko.com/en/exchanges/decentralized)

[https://coinmarketcap.com](https://coinmarketcap.com/rankings/exchanges/dex/)

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://web3-encyclopedia.gitbook.io/web3-encyclopedia/decentralized-finance-defi/cex-vs-dex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
