Swapping tokens on Ethereum means trading one asset for another directly from your own wallet, without depositing funds on a centralized exchange. A decentralized exchange (DEX) runs on smart contracts, so the trade settles on chain once the transaction is confirmed. This guide explains how a DEX swap works, what you pay in gas, and how slippage settings protect your trade.
What a DEX Swap Is
Most Ethereum DEXs use an automated market maker (AMM) model instead of an order book. Liquidity providers deposit pairs of tokens into a pool, and a pricing formula sets the exchange rate based on the ratio of tokens in that pool. When you swap, you add one token to the pool and remove the other, which shifts the price slightly.
Uniswap is the best known example. Its official documentation describes the protocol contracts, the concentrated liquidity design used in later versions, and how routing finds a path between tokens. Other DEXs and aggregators follow similar principles, and aggregators split orders across several pools to find a better price.
Because the pool holds a finite amount of liquidity, larger trades move the price more. This effect is called price impact, and it is separate from slippage, which is covered below.
What You Need Before Swapping
Before making a swap, prepare the following:
- A self-custody wallet that supports Ethereum, such as a browser extension or mobile wallet.
- ETH in that wallet to pay gas fees. Every transaction on Ethereum mainnet requires ETH for gas, even if you are swapping two other tokens.
- The token you want to sell, already in the same wallet.
- The correct contract address for the token you want to buy. Scam tokens often copy the name and ticker of real projects, so confirm the address on the project's official site.
How to Complete a Swap
The process is similar across most DEX interfaces:
- Open the DEX website and confirm the URL is correct. Phishing sites that imitate popular DEXs are common.
- Connect your wallet and select the Ethereum network.
- Choose the token you are selling and the token you are buying. If a token does not appear in the default list, paste its contract address.
- Enter the amount. The interface will show an estimated output, the price impact, the route and a network fee estimate.
- Approve the token if this is your first time selling it on that DEX. ERC-20 tokens require an approval transaction that gives the DEX contract permission to move them. Some interfaces use signature-based permits to reduce extra transactions.
- Review slippage tolerance and transaction deadline settings.
- Confirm the swap in your wallet and wait for the transaction to be included in a block.
Swapping ETH itself works slightly differently. Many pools hold wrapped ETH (WETH), an ERC-20 version of ETH. Most interfaces wrap and unwrap automatically, but you may sometimes see WETH in your wallet after a trade.
How Gas Fees Work
Gas measures the computational work a transaction requires. A simple ETH transfer uses 21,000 gas units. A token swap uses more, often well above 100,000 units, because it calls several contract functions. Complex routes through multiple pools cost more than a single pool swap.
According to the Ethereum gas documentation, the fee you pay equals the gas units used multiplied by the sum of the base fee and the priority fee. Gas prices are quoted in gwei, where one gwei equals one billionth of an ETH.
The current fee structure was introduced by EIP-1559. Under this design:
- The base fee is set by the protocol and adjusts block by block depending on network demand. It is burned rather than paid to validators.
- The priority fee, or tip, goes to the validator and encourages faster inclusion.
- The max fee is the highest total you are willing to pay per unit of gas. Any amount not used is refunded.
Gas costs depend on network activity, not on the size of your trade. A swap of 50 dollars costs about the same in gas as a swap of 50,000 dollars. For small trades, gas can be a large share of the total cost. Checking fees before trading and swapping during quieter periods can reduce what you pay. Layer 2 networks such as Arbitrum, Optimism and Base offer much lower fees for the same type of swap, though you must first bridge assets to them.
Understanding Slippage
Slippage is the difference between the price you see when you submit a trade and the price you receive when it executes. On Ethereum, a few seconds can pass between signing and confirmation, and other trades in the same pool can change the price during that time.
Slippage tolerance is the maximum price change you accept. If the final output would fall below your minimum, the transaction reverts. You still pay gas for a reverted transaction, but you do not receive a worse trade.
General guidance for setting slippage:
- For large, liquid pairs such as ETH and major stablecoins, a low tolerance like 0.1 to 0.5 percent is usually enough.
- For smaller or volatile tokens, you may need 1 to 3 percent for the trade to go through.
- Tokens with transfer taxes require slippage at least equal to the tax, or the trade will fail.
- Many interfaces offer an automatic setting that estimates a suitable value.
Setting slippage too high creates risk. Bots that monitor pending transactions can place trades before and after yours, a pattern called a sandwich attack, and capture value up to your tolerance limit. Keeping tolerance as low as practical limits this exposure. Some wallets and DEXs also support private transaction submission to reduce visibility in the public mempool.
The transaction deadline is a related setting. It cancels the swap if it has not been confirmed within a set number of minutes, which prevents an old transaction from executing at an outdated price.
Common Mistakes to Avoid
- Buying a token from an unverified contract address.
- Leaving no ETH for gas after a swap, which blocks future transactions.
- Granting unlimited token approvals to contracts you do not trust. You can review and revoke approvals with wallet tools.
- Ignoring high price impact warnings on low liquidity pools.
- Raising slippage repeatedly to force a trade through on a token you have not researched.
Track on CoinMarketGuy
Before you swap, use CoinMarketGuy's real-time price data to compare DEX quotes against broader market prices and spot unusual price impact. The whale tracker shows large wallet movements and big DEX trades that can shift pool prices or signal rising volatility, which may call for adjusted slippage settings. Market sentiment tools add context on whether activity in a token is building or fading, helping you time swaps with more information.