SwappingIntermediate

Gas Fees Explained: Ethereum and Layer 2 Costs

How base fee, priority fee and gas limit add up, why the same swap costs dollars on mainnet and cents on Base, and practical ways to pay less gas.

ChainBridge ResearchUpdated 5 min read

On this page6 sections

Key takeaways

  • Your gas cost is gas units used times the price per unit: a token swap uses roughly ten times the gas of a plain ETH transfer.
  • On Ethereum the price per unit is a burned base fee set by demand plus a small tip to the validator; unused gas is never charged.
  • Layer 2 networks pay a tiny execution fee plus a share of the cost of posting data to Ethereum, which is why swaps there cost cents.
  • ChainBridge ranks quotes after gas, so a route that looks better but burns more gas does not win.

What gas is

Every transaction asks validators to run code and store data. Gas is the unit that measures that work, and the gas fee is what you pay for it. It also keeps the network usable: spamming it with useless transactions would cost real money.

The amount of work depends on what the transaction does. A plain ETH transfer always uses 21,000 gas units. A token swap reads and updates pool contracts, moves tokens and may hop through several pools, so it uses far more. Adjust the gas price and ETH price below to turn units into dollars.

Typical gas used per action (approximate)

050K100K150K200KETH transfer21,000 · $0.06ERC-20 transfer~50,000 · $0.15ERC-20 approve~46,000 · $0.14Simple swap (single pool)~120,000 · $0.36Aggregator swap (multi-hop)~200,000 · $0.60Cross-chain deposit~150,000 · $0.45

Cost = gas used x gas price. Example values, not live prices; on Ethereum mainnet gas is paid in ETH.

Show data as a table
Typical gas used per action and its cost
ActionGas usedCost
ETH transfer21,000$0.06
ERC-20 transfer~50,000$0.15
ERC-20 approve~46,000$0.14
Simple swap (single pool)~120,000$0.36
Aggregator swap (multi-hop)~200,000$0.60
Cross-chain deposit~150,000$0.45
Typical gas units by action. Exact figures depend on the token and route; prices are inputs, not live data.

How the price is set on Ethereum

Since the London upgrade in 2021, Ethereum prices gas with EIP-1559. The price per unit has two parts, and you set two caps that protect you from paying more than you meant to.

Parts of an EIP-1559 gas fee
PartSet byGoes toWhat to know
Base feeThe protocol, block by blockBurnedRises when blocks are more than half full, falls when they are less, by up to 12.5% per block.
Priority fee (tip)You, usually suggested by the walletThe validatorA small tip gets you into the next block; a bigger one only helps when blocks are full.
Max fee per gasYouCap onlyThe most you accept per unit. Anything above base fee plus tip is not charged.
Gas limitWallet estimateCap onlyThe most units the transaction may use. Unused gas is not charged.

What you actually pay is gas used × (base fee + priority fee). If the base fee drops while your transaction waits, you pay the lower one. If the transaction runs out of gas or reverts, the gas used up to that point is still charged.

Working out the cost

Gas prices are quoted in gwei, a billionth of an ETH (1 ETH = 1,000,000,000 gwei). Here is a mainnet swap with illustrative numbers, not current prices:

Gas used
150,000
typical swap
Base fee
20 gwei
example
Priority fee
2 gwei
example
Total
0.0033 ETH
about $9.90 at $3,000/ETH

150,000 × 22 gwei = 3,300,000 gwei = 0.0033 ETH. At 2 gwei instead of 22, the same swap costs ten times less. Gas units barely change between quiet and busy hours; the price per unit is what moves.

Why layer 2 is cheaper

Rollups such as Arbitrum, Base, Optimism and Linea execute transactions on their own chain and post compressed data back to Ethereum for security. Your fee has two parts: a very small execution fee on the layer 2, and your share of the cost of posting that data to Ethereum.

The Dencun upgrade (March 2024, EIP-4844) gave rollups a cheaper place to post data, called blobs, which cut the data part sharply. Polygon, BNB Chain and Avalanche are separate chains with their own validators, fee markets and gas tokens.

Gas token and fee model on ChainBridge networks
NetworkGas paid inFee model
EthereumETHLayer 1, EIP-1559 base fee plus tip
ArbitrumETHLayer 2 execution plus Ethereum data fee
BaseETHLayer 2 execution plus Ethereum data fee
OptimismETHLayer 2 execution plus Ethereum data fee
LineaETHLayer 2 (zk rollup) execution plus Ethereum data fee
PolygonPOLIndependent chain with its own fee market
BNB ChainBNBIndependent chain with its own fee market
AvalancheAVAXIndependent chain with its own fee market

You need a little of the gas token on each network you use. Read layer 2 networks for how rollups work.

Practical ways to pay less

Swap on a layer 2

The same swap usually costs cents on Arbitrum, Base, Optimism or Linea instead of dollars on mainnet. If your funds are already there, stay there.

Pick a quiet moment on mainnet

Ethereum base fee follows demand. Nights and weekends (UTC) are often quieter. Check a gas tracker before a non-urgent trade.

Avoid failed transactions

A revert still burns the gas used up to the failure. Refresh stale quotes and let simulation catch a bad transaction before you send it.

Leave the gas limit alone

Lowering it does not save money: unused gas is never charged, and a limit that is too low makes the transaction fail and still cost you.

Approve exactly what you swap

Each new approval is its own transaction. ChainBridge approves the exact amount and, when your wallet supports it, sends approval and swap in one confirmation.

Go gasless when it wins

A gasless swap lets 0x pay the gas and recover it from the trade, useful when you hold no native token. It competes with regular routes on net amount.

How ChainBridge accounts for gas

Gas is part of the price comparison. Each quote's gas cost is converted into the token you receive and subtracted before ranking, so you see the route that leaves you the most, not the one with the biggest headline number. See smart order routing.

On Ethereum, Arbitrum, Base, Optimism, Polygon, BNB Chain and Avalanche, a gasless swap may also be offered: you sign an order, 0x pays the gas, and that cost is taken from the trade. It is not available on Linea, for the native gas token as the token you sell, or from smart contract wallets.

To estimate a specific transaction yourself, use the gas cost calculator.

Compare routes after gas

Every quote is ranked by what you receive once the platform fee and network gas are counted.

Open the swap