back to lessons
$ ~/learn/gas-fees cat
5 min read
// 20 · fundamentals

How gas fees work

Every action on a blockchain costs a small fee. Understanding why makes cheap chains — and expensive ones — make sense.

> What gas is

'Gas' is the unit of computational work a transaction consumes. A simple ETH transfer uses ~21,000 gas; a complex DeFi swap can use 200,000+. You pay a price per unit of gas, denominated in the chain's native token (ETH, SOL, MATIC, etc.).

> Why prices spike

Block space is a scarce auction. When lots of people want their transaction included right now, they bid the gas price up. That's why fees spike during NFT mints, airdrops, or major liquidations — everyone competes for the next block.

> How to save

Use L2s for routine activity (Base, Arbitrum, Optimism) — often 10-100x cheaper. Batch actions when possible. Set a lower priority fee if you're not in a hurry. Check gas trackers before making a big transaction on mainnet.