Coins: 15,977
Exchanges: 1,183
Market Cap: $3.864T 1.0%
24h Vol: $207.365B
Gas: 6.675 GWEI
Go Ad-free
Guides
TABLE OF CONTENTS

Crypto Masterguide: How to Swap Tokens, Buying and Selling Crypto on the Blockchain

4.7
| by
Loke Choon Khei
|
Edited by
Vera Lim
-

How to Swap Tokens on the Blockchain With DEXs

You can swap tokens by connecting your non-custodial wallet (like MetaMask) to decentralized exchanges (DEXs). Input the token you wish to swap and the token you wish to buy, approve tokens, click swap, and sign the transaction with your wallet.


Key Takeaways

  • Token swaps are essential in allowing users to buy and sell their tokens over the blockchain on their own self custodial wallets through decentralized exchanges (DEXs).

  • Users must consider gas fees, token approvals and token contract addresses before they perform their token swap.

  • Token swaps are best conducted at the largest DEXs which differs from blockchain to blockchain. Alternatively, users can also use DEX aggregators to find the best token swap rates.


crypto security update cover new

In this series, we will cover everything you need to know about swapping tokens on the blockchain using decentralized exchanges (DEXs), where to do it, the common pitfalls and much more! Before we begin on where and how to do it, let’s go through some of the basic concepts of token swaps.

What Are Token Swaps?

Token swaps on the blockchain are akin to you buying/selling things online, while you exchange money for goods and services in real life. On the blockchain, we exchange one token for another. If you were to live in the United States, the United States Dollar (USD) is the common currency used to buy and sell goods. Similarly, on Ethereum, ETH is the commonly used currency to exchange for other tokens.

What Are Gas Tokens and What Are They Used For?

The reason why ETH is commonly used to exchange for other tokens on Ethereum is because ETH is the gas token of the Ethereum blockchain. Gas tokens are the tokens needed to pay for transaction fees. This is another important consideration for users before you conduct your token swaps. In addition to swapping your tokens, you must also consider how much funds are needed to pay for fees. Let’s say you have $100 worth of ETH and you wish to buy/swap into $100 worth of USDC, you must have more than $100 worth of ETH so that you may buy/swap into $100 worth of USDC and have enough to pay for transaction fees too.

A general rule of thumb is that you should have at least $10 worth of gas tokens set aside to pay for your transaction fees at all times. This will help you avoid the situation where you wish to swap tokens but not have enough to pay for fees.

Note: If you are transacting on Ethereum (mainnet), transaction fees are much higher and it's recommended to have at least $50 worth of gas tokens (ETH) set aside.

Token Approvals: For Ethereum/EVM Blockchains

If you are transacting on blockchains that are EVM compatible such as Ethereum, BSC, Base, Arbitrum, Avalanche, Polygon, Optimism, etc. Token approvals is something you should know about. On these blockchains, token approvals will be needed if you attempt to transact anything other than the gas token of the respective blockchains. Token approvals are a security feature of EVM chains. Smart contracts that wish to transfer or interact with any of your holdings other than gas tokens will require additional explicit permission (via token approvals) before they can do so. Below are some examples of how token approvals on EVM chains work.

Example 1: Swapping USDC to ETH on Arbitrum (Ethereum Layer 2)

ETH is the gas token on Arbitrum, this means that if you wish to swap (sell) any other tokens, you will need to approve the token you wish to sell. In the example below, an approval for the amount of USDC you want to swap will be required before you can do a token swap to exchange USDC for ETH. If you reverse the transaction order, swapping ETH to USDC, token approvals are not required before you can swap your tokens.

masterguide token swaps 2

Example 2: Swapping AVAX to USDC on Avalanche (Layer 1)

On Avalanche, AVAX is the gas token. Swapping AVAX to USDC thus requires no token approval and you can go straight to swapping without token approval. Intuitively, this means that if you’re transacting on EVM chains, holding and transacting with the gas token will be more convenient compared to transacting with other tokens.

masterguide token swaps 3

Cautionary Note on Token Approvals

When prompted for token approvals, there may be cases where the decentralized application (dApp) you are interacting with will autofill the amount of tokens approved to be infinite (or just an obscenely large number). This is bad practice as it can lead to your crypto wallet being opened up for potential exploitations by crypto hackers. Although it can be slightly more cumbersome, always approve only the amount of tokens you are going to transact with and revoke unused approvals occasionally. Learn more about how to revoke token approvals in our crypto security article here!

An example of a dApp requesting for infinite token approval by default.

masterguide token swaps 4

General Flow of How Token Swaps are Done

That’s all the basic information you need, now you are ready to perform your token swaps! Where you swap your tokens and what you swap your tokens with will differ from blockchain to blockchain, but the general flow is usually as follows:

  1. Go to a decentralized exchange (DEX).

  2. Connect your crypto wallet (Metamask, Rabby, Phantom, Keplr, etc.).

  3. Select your input token (the token you wish to sell).

  4. Select your output token (the token you wish to buy).

  5. Approve tokens if needed (Only for EVM chains).

  6. Click ‘swap’.

  7. Complete the transaction.

Full Example of Swapping ETH to USDC on Base

Below we will go through in detail how to perform a swap on Base, you may replicate this process on the various other DEXes for the other blockchains. The process will be highly similar with the exception of token approvals for EVM chains.

Step 0.5: Ensure that you have sufficient gas tokens for this transaction (ETH on Base)

Step 1: Go to your choice of a DEX on Base and connect your wallet

masterguide token swaps 5

Aerodrome Finance will be used in this example. You may refer to https://defillama.com/chain/Base for the full list of Base dApps to choose your preferred DEX. DefiLlama is a good resource for users who wish to explore and find new dApps to interact with.

Step 2: Select your input token (selling) and your output token (buying)

masterguide token swaps 6

When selecting your output token (token you wish to buy), ensure that the contract address (“0x8335…02913” for USDC) of the token you have selected is the correct one. This is important because in crypto there are many derivatives of the same asset you wish to swap for. For instance, axlUSDC also exists on Base, which can confuse new users, to ensure that you swap for the correct token you intend to buy, always verify the token contract address (CA for short), you may use CoinGecko’s token information page to do this as these have been carefully vetted by our operations team!

masterguide token swaps 7

Author’s note: Personally, I recommend searching for tokens via contract address, meaning to copy and paste the full CA of USDC (0x833589fcd6edb6e08f4c7c32d4f71b54bda02913) when searching for the token. It is more cumbersome but it is good practice and ensures that you are swapping for the intended token.

Step 3: Enter the amount to swap, signing any token approvals if needed

masterguide token swaps 8

ETH has been selected as the base to swap into USDC. Since ETH is the gas token used on Base, no token approvals are needed prior to swapping.

Step 4: Perform the swap

You can check the status of your transaction in your crypto wallet, it may take some time for the transaction to go through especially during periods of network congestion. Once the transaction is finalized, it will be recorded on the blockchain explorer and you can view it on Base’s blockchain explorer, by searching for your transaction ID.

masterguide token swaps 9

Token Swap Masterlist

In this section, we will provide you with summarized key information on all leading blockchains where decentralized finance (DeFi) activities occur. We will share the top DEX in each blockchain (by Total Value Locked) and the gas token the blockchain uses. Generally, users would prefer to swap their tokens on the largest DEX as token liquidity is generally the largest on these DEXs. Large and deep liquidity pools are preferred as traders would typically enjoy lower slippage on their trades. Lower slippage ensures traders get token swap rates closer to the displayed prices and makes transactions more likely to go through on the blockchain (high slippage transactions tend to fail).

How and Where to Swap Tokens on Ethereum

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Base (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Arbitrum (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Optimism (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and where to swap tokens on Linea (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and where to swap tokens on Scroll (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and where to swap tokens on ZKsync (Ethereum L2)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Solana

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Binance Smart Chain

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Sui

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on TON

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Avalanche

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Polygon

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Aptos

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Tron

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Cronos

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Fantom

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

How and Where to Swap Tokens on Osmosis (Cosmos)

Top decentralized exchange (DEX) by Total Value Locked:

Gas Token:

Decentralized Exchange (DEX) Aggregator

While the above list shows you the top DEXs by TVL in each blockchain at the time of writing, this is still subject to market changes in the future. To help traders achieve the best possible rates with the lowest slippage, traders may use a decentralized application (dApp) tool called DEX aggregators. 

Functionally, DEX aggregators appear to work the same as DEXs, the front-end and user interface (UI) is similar to that of DEXs and the process to use them for token swaps remains the same. On the back end, DEX aggregators are different in that they scour their respective blockchain and all the DEXs within to find the most efficient and effective way to route your trades to get users the best possible rates. These aggregators may charge a small fee for this service, or free in the case of Solana’s Jupiter.

Consider using DEX aggregators when you are unsure of which DEX to use to perform token swaps. Currently, the most popular DEX aggregators are:

For Ethereum/EVM chain users – 1inch

For Solana users – Jupiter

Solana’s DEX aggregator, Jupiter.

masterguide token swaps 10An example of how Jupiter routes trades through 3 different liquidity pools using two different DEXs (Meteora and Orca) to get the best available rates.
masterguide token swaps 11

Conclusion

That’s it! This should be everything you need to know to get you started on your DeFi journey whether it be trading memecoins, trying out DEXs or simply buying your favorite non-listed crypto token.

This article is only for informational and educational purposes and should not be taken as financial advice. Always do your own research before engaging with any protocol.

CoinGecko's Content Editorial Guidelines
CoinGecko’s content aims to demystify the crypto industry. While certain posts you see may be sponsored, we strive to uphold the highest standards of editorial quality and integrity, and do not publish any content that has not been vetted by our editors.
Learn more
Want to be the first to know about upcoming airdrops?
Subscribe to the CoinGecko Daily Newsletter!
Join 600,000+ crypto enthusiasts, traders, and degens in getting the latest crypto news, articles, videos, and reports by subscribing to our FREE newsletter.
Tell us how much you like this article!
Vote count: 3
Loke Choon Khei
Loke Choon Khei
Choon Khei has been involved in the cryptocurrency space since 2021. Choon Khei specialises in DeFi strategies and airdrop farming routes. When not accumulating more points, Choon Khei enjoys his time making himself a pour-over coffee. Follow the author on Twitter @Seol_luna

Related Articles

Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Log in
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
Sign up
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
Didn't receive confirmation instructions?
Resend confirmation instructions
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores
coingecko
Continue in app
Track prices in real-time
Open App