Gas Fee
The total cost of an Ethereum transaction, calculated as gas used multiplied by the gas price (in gwei). Fees compensate validators for processing the transaction and rise during network congestion.
How gas fees are calculated
Total gas fee is the product of two components:
Gas Fee = Gas Used × Gas Price
Gas used is the computational work consumed by the transaction. Gas price (in gwei) is what you pay per unit. Both vary by transaction type and network conditions.
Different operations use different amounts of gas:
- Simple ETH transfer: 21,000 gas
- ERC-20 token transfer: 50,000-65,000 gas
- DEX swap: 100,000-300,000 gas
- Complex DeFi interaction: 300,000-1,000,000+ gas
At a 25 gwei gas price, a typical DEX swap consuming 200,000 gas costs 0.005 ETH — roughly $15-25 depending on ETH price.
Why gas fees fluctuate
Gas prices respond to network demand:
- High network activity — many users competing for limited block space; gas prices spike to ration capacity.
- Low network activity — gas prices fall toward the protocol minimum.
- Specific events — popular NFT mints, token launches, market volatility, exploits all spike gas.
Bitcoin's 2017 peak saw gas prices well above 100 gwei sustained for hours. The 2021 NFT boom saw periods where simple swaps cost $200+ in gas. The 2022-2023 bear market saw gas prices fall below 10 gwei for extended periods.
EIP-1559 (since August 2021)
Ethereum's EIP-1559 changed the fee model:
- Base fee — algorithmically set per-block; burned rather than paid to validators.
- Priority fee — additional tip to validators to incentivize inclusion.
Total fee = (Base Fee + Priority Fee) × Gas Used
The base fee adjusts up when blocks are full, down when they're empty. This makes gas prices more predictable than the previous first-price auction. The burn portion has destroyed millions of ETH since launch — over $11B in cumulative burn through 2024.
Layer 2 fees
Layer 2 gas fees work similarly but at much lower absolute costs:
- Optimistic rollups (Arbitrum, Optimism, Base) — typically $0.05-1 per transaction.
- ZK-rollups (zkSync, Starknet) — similar range.
- EIP-4844 blob fees — most L2 data costs went down 90%+ after Ethereum's Dencun upgrade in March 2024.
The cost split: a small fraction is "L2 execution gas" (paid to L2 sequencer); the larger fraction historically was "L1 data cost" (paid to post data to Ethereum mainnet). Blobs reduced the L1 data cost dramatically.
Gas fee strategies
For users trying to minimize gas costs:
- Time transactions strategically. Gas prices vary by time of day and day of week. Nights, weekends, and off-peak hours typically cheaper.
- Use L2s. For routine transactions, L2 fees are typically 1/100th of mainnet fees.
- Batch operations. Account abstraction and multicall contracts let multiple operations execute in one transaction, sharing the base 21,000 gas overhead.
- Use limit orders carefully. Limit-order systems that re-execute on every price change can rack up gas costs.
- Consider gas-optimized protocols. Different DEX implementations use different amounts of gas; aggregators choose the cheapest path.
Failed transactions still cost gas
A common surprise: if a transaction fails (insufficient slippage tolerance, contract revert, etc.), you still pay gas for the work done up to the failure. Failed transactions can cost the full gas budget if they fail late in execution.
Common ways to limit this:
- Simulation tools (Tenderly, Blocknative) preview transactions and warn about likely failures.
- Some wallets do simulation automatically before signing.
- Setting gas limits at reasonable levels prevents catastrophic overpayment on failures.
Gas fees on other chains
Different blockchains have different fee models:
- Bitcoin — fees are paid in BTC, denominated in satoshis per byte. Vary with network congestion. Typically $1-5 per simple transaction in normal conditions.
- Solana — base fee + priority fee structure similar to EIP-1559 but at much lower absolute cost. Fractions of a cent per transaction normally.
- BNB Chain, Polygon, Avalanche — generally pennies for typical transactions.
- Sui, Aptos — fee models specific to their architectures, generally low.
Each chain's fee structure shapes user behavior. Ethereum's high fees push users to L2s and simpler operations; Solana's low fees enable high-volume use cases like memecoin trading.
Gas tokens (historical)
A historical hack: gas tokens (CHI, GST2) exploited gas refunds to "store" gas during low-price periods and "redeem" it during high-price periods. The refund mechanic was removed in EIP-3529 (London hard fork, August 2021). Gas tokens are obsolete.
Where gas costs go
The breakdown of gas fees:
- Base fee — burned. Removed from ETH supply permanently.
- Priority fee — paid to validators (or proposers in PoS).
- L2 fees — partly paid to sequencer (L2 operator), partly paid to L1 (Ethereum) for data posting.
The economic implications:
- High activity → more ETH burned → potentially deflationary supply.
- Validators earn primarily from priority fees (block subsidies are smaller post-Merge).
- L2 sequencers retain meaningful fee revenue, which is one of the major business models in the L2 space.
Gas fees as friction in adoption
Gas remains one of the largest friction points for crypto adoption:
- New users find variable, sometimes-expensive transaction costs confusing.
- Mainstream applications (web2 payments, gaming) don't have per-action costs at all.
- Retail users especially balk at $20+ transactions for sub-$100 amounts.
Layer 2 adoption has reduced this dramatically, but cross-chain UX (managing gas tokens on multiple chains) reintroduces complexity. Account abstraction and gas sponsorship (where dApps pay gas for users) are partial solutions that are growing but not yet ubiquitous.