DEX Education · How to
How to Swap Tokens on a DEX
A swap looks like one action and is really several authorisations with three separate costs. This walks through both.
Direct answer
To swap tokens on a DEX: connect your wallet, select the input and output tokens, verify the output token's contract address, enter an amount, check the price impact, set slippage tolerance to the smallest workable value, approve the input token if required, then confirm the swap. You pay three separate costs — the swap fee, price impact, and gas — and only the middle one scales with your trade size.
Prerequisites
- A wallet holding roughly what you intend to trade, not your main holdings.
- Some of the chain's native asset for gas — you cannot move a token you own without it.
- The output token's contract address from a source the project controls.
Step 1 — Connect the right wallet
Connect the wallet sized to this trade. Connecting shares your address and lets the site request signatures; it grants no spending power. See how to connect a crypto wallet.
Step 2 — Select tokens, and verify the output one
Choose what you are spending and what you are buying.
Search by contract address, not by name. Token names and tickers are not unique — anyone can deploy a contract using an existing project's name, and create a pool for it. Selecting by name from a search result is the single most common way people buy an impersonator.
If the interface warns the token is unverified or not on a default list, that is information, not a formality.
Step 3 — Enter an amount and read the price impact
Enter the amount, then look at the price impact figure before anything else.
Impact is the movement your own trade causes along the pool's curve. It is arithmetic, computable in advance, and it grows faster than your trade size — doubling the trade more than doubles the impact.
| Impact shown | What it means |
|---|---|
| Under ~0.5% | Pool is deep relative to your size |
| 1–3% | Noticeable; consider splitting |
| Over ~5% | Your trade is large for this pool |
| Double digits | You are moving the market against yourself |
A thin pool will still fill you. A constant-product curve never runs out — it just gets worse. That is why "the trade went through" is not evidence it was a good idea. See how decentralized exchanges work.
Step 4 — Set slippage tolerance
Set it as low as will reliably execute.
Tolerance is not price impact. It is how much additional adverse movement you accept from transactions landing before yours — which on a public mempool is exactly the budget available to anyone sandwiching your trade.
If a swap keeps failing at low tolerance, the honest diagnosis is usually that the trade is too large for the pool or the market is moving fast. Raising tolerance hides that rather than solving it.
Step 5 — Approve, if required
For an ERC-20 input token you will first approve the contract to move it. Native assets skip this.
- Check which token and which contract.
- Prefer a finite amount over unlimited.
- A permit (gasless signature) grants the same authority — read it just as carefully.
This is the prompt that drains wallets when it is malicious. It is worth the extra five seconds every time.
Step 6 — Confirm the swap
Review in the wallet, not just the website: amounts, the destination, the network. On a hardware wallet, read the device screen.
Then confirm and wait for the transaction to be included.
The three costs
total cost = swap fee + price impact + gas
- Swap fee — a fixed percentage, commonly around 0.30% though tiers vary. Predictable.
- Price impact — depends on your size relative to pool reserves. The one you control, by sizing.
- Gas — depends on network congestion, not on trade size. Dominates small trades.
Small trade in a deep pool: gas is most of your cost. Large trade in a thin pool: impact is nearly all of it. Comparing venues on the swap fee alone misses most of what you pay.
When a swap fails
A failed transaction still costs gas — the work was done and the state reverted.
- Reverted on slippage — the price moved past your tolerance. This is the protection working.
- Insufficient gas — the limit was too low.
- Stuck pending — the fee was too low; usually replaceable by resubmitting with the same nonce and a higher fee.
- Repeated failures at sensible settings — treat as a signal about the token or the pool, not a settings problem to bulldoze.
After the swap
- Check what arrived. With a fee-on-transfer token the amount received will be less than quoted.
- Revoke the approval if you are finished with that contract.
- Confirm you could exit — the same pool and curve apply on the way out.
Common mistakes
- Selecting a token by name rather than contract address.
- Raising slippage until it works.
- Approving unlimited by reflex.
- Ignoring price impact because the trade executed anyway.
- Holding no native asset for gas.
Related
Step-by-step
How to Swap Tokens on a DEX
Trade one asset directly for another via an AMM.
-
Select input/output
Choose what you have and what you want.
-
Check the quote
Inspect the rate and slippage breakdown.
-
Approve token
Approve the contract once per token, then swap.
-
Confirm
Sign and wait for chain confirmation.
Related on DEX Education
-
How Decentralized Exchanges Work
Most explanations stop at 'smart contracts handle it'. This one shows the formula that sets your price and walks the ari...
-
How to Use a DEX Safely
A routine that limits what any single mistake can cost, rather than relying on you spotting every threat.
-
Trading With USDT
Quoting in a stablecoin is an exposure, not a neutral resting place. Which exposure depends on how the coin is backed.
-
DEX Glossary
Definitions of the terminology used across CoinDock's DEX guides.
-
How to Reduce Slippage
Slippage is predictable before you trade. These are the techniques that reduce it, in order of effectiveness.
Learn How CoinDock Works
Continue your CoinDock journey.
Go