Blockchain · 7 min read

How to Calculate Ethereum Gas Fees

On Ethereum, you pay for **computation and storage** in **gas**, priced in **Gwei** per gas unit. Simple transfers use ~21,000 gas; DeFi interactions use far more. **L2s** batch transactions—fees are often lower but include bridge costs.

Core formula

Fee = gas used × gas price · Gwei = 10⁻⁹ ETH

Step by step

1. Estimate gas units

Wallets estimate gas limit—ETH transfer ~21k; swaps often 150k–250k+ depending on route.

2. Set gas price (Gwei)

Base fee + priority tip. Higher Gwei = faster inclusion in congested blocks.

3. Convert to ETH/USD

Fee ETH = gas × Gwei × 10⁻⁹. Multiply by ETH/USD for dollar cost.

Mainnet vs L2 vs other chains

Compare total cost including bridges and failed-tx gas.

  • Ethereum L1: Highest security/cost; fee spikes at congestion.
  • Rollups (L2): Lower per-tx fee; add bridge time/cost.
  • Failed transactions: You can still pay gas for reverts on L1.
  • NFT/mint spikes: Gas wars during drops—model worst-case Gwei.

Common mistakes

  • Using transfer gas for swap estimates
  • Ignoring L1 bridge fees
  • Setting max fee too low and stalling

FAQ

What is Gwei?

10⁻⁹ ETH; gas prices are quoted in Gwei per gas unit.

Why did fee differ from estimate?

Actual gas used can be below limit; price can move before confirmation.