New to Rust? Grab our free Rust for Beginners eBook Get it free →
Token swaps: how crypto swaps work, fees, price impact, and safety

A token swap exchanges one crypto asset for another through a wallet, decentralized exchange, or exchange service, and the important question is which network, route, fee, price impact, and approval the transaction will use.
What is a token swap?
A token swap is an exchange of one token for another. In a wallet-based swap, you sign a transaction that sends the input token to a contract or router and receives the output token if the transaction meets its conditions.
The term also appears in project migrations, where an old project token is replaced with a new token under rules announced by that project.
What happens when you submit a swap?
A swap interface builds a quote from available liquidity and asks your wallet to sign the required transaction. Ethereum.org describes swaps as an exchange that can occur through a decentralized exchange, while Uniswap documents the pool-based route used by its protocol.
- You choose the input token, output token, amount, and network.
- The interface estimates the output, route, price impact, network fee, and minimum amount you can receive.
- Your wallet may ask for an approval before the swap transaction can spend an ERC-20 token.
- You review the transaction and sign it. The chain then confirms or rejects it according to the contract conditions.
The quoted output is an estimate until execution because network conditions, pool liquidity, the route, and a token’s transfer rules can change what the transaction can complete.
Why the quote can differ from the price you saw
Automated market makers use pool reserves to price a swap, so a larger order takes more of the output reserve and can move its execution price away from the pool’s mid price.
Price impact and slippage are separate checks
Uniswap defines price impact as the effect of your trade on execution price. Slippage is the price movement between submission and execution, so a slippage tolerance sets the condition that can stop a transaction from filling below your chosen minimum.
Fees also reduce the amount received. A route can contain pool fees and a network fee, and a cross-chain route can add bridge-specific conditions.
A small automated market maker quote
The following Node.js calculation was executed with an input reserve of 10,000, an output reserve of 20,000, and a 1,000-token order. It is a teaching model for a constant-product pool rather than a quote for a market.
const reserveIn = 10_000;
const reserveOut = 20_000;
const amountIn = 1_000;
const feeRate = 0.003;
const amountInAfterFee = amountIn * (1 - feeRate);
const amountOut = (amountInAfterFee * reserveOut) / (reserveIn + amountInAfterFee);
const midPrice = reserveOut / reserveIn;
const executionPrice = amountOut / amountIn;
const priceImpact = (1 - executionPrice / midPrice) * 100;
console.log(`Output after a 0.3% fee: ${amountOut.toFixed(2)}`);
console.log(`Difference from the mid price: ${priceImpact.toFixed(2)}%`);
The calculation returns 1,813.22 output tokens and a 9.34% difference from the mid price because the order is large relative to the reserves.

Checks to make before you sign
A clean-looking swap screen does not prove that the token or contract is safe. MetaMask’s support guidance lists slippage among common swap-failure causes, and the contract address remains the most useful identity check for a token.
- Verify the network and the token contract address from an official project source.
- Compare the estimated output, minimum received, price impact, and every listed fee.
- Read the approval request. Use the smallest allowance your wallet and the application support, then revoke unused approvals when appropriate.
- Keep enough native currency for the network fee, and begin with a small transaction when the token or route is unfamiliar.
Do not raise slippage tolerance merely to force a transaction through, since a filled transaction at an unacceptable amount can be harder to recover from than a failed transaction.
How migration token swaps differ
For a project migration, use the project’s official announcement and official application, then check the old and new contract addresses, conversion ratio, network, deadline, and claim method.
Search ads and direct messages are poor sources for migration instructions. Open the project’s verified site yourself, then compare the details with its published documentation before connecting a wallet.
Make the quote explain itself
Before you sign, identify the input token, output token, network, minimum received, price impact, fee, and approval. If any field is unclear, stop at the quote and verify the contract address and route before committing funds.
Sources
Ethereum.org: How to swap tokens
Uniswap Developers: Swaps
MetaMask Help Center: Why did my MetaMask swap fail?
1inch Help Center: Price impact versus price slippage




