Gas is the unit that measures the computational work needed to execute a transaction or smart contract on Ethereum and other EVM blockchains. Every operation, from a simple transfer to a complex DeFi trade, costs a certain amount of gas, and users pay for that gas in the network's native coin, such as ETH. Gas fees reward validators for processing transactions and protect the network against spam and endless loops.
How are gas fees calculated?
The fee is the amount of gas used multiplied by the price per unit of gas, expressed in gwei (one billionth of an ETH). Since the London upgrade in 2021 (EIP-1559), the price consists of two parts:
- Base fee: set by the network for each block, rising when blocks are full and falling when they are not. The base fee is burned.
- Priority fee (tip): an optional extra paid to the validator to get included faster.
- Gas limit: the maximum amount of gas a transaction may use. A simple ETH transfer uses 21,000 gas; contract calls use more depending on their complexity.
If a transaction runs out of gas or fails, the gas used up to that point is still paid, because the network did the work.
Why gas fees vary
Gas prices depend on demand for block space. During busy periods, such as popular token launches or market crashes, fees on Ethereum mainnet can rise sharply. Layer 2 networks such as Arbitrum, Optimism and Base bundle many transactions and settle them on Ethereum, which makes fees much lower, especially since blob transactions were introduced in 2024. Other blockchains, such as Solana, have their own fee models.
Reducing and hiding gas costs
- Gas-efficient contracts: careful storage design and fewer writes can significantly lower the gas per transaction.
- Batching: combining several actions into one transaction.
- Layer 2: moving activity to a cheaper network.
- Gasless transactions: with a paymaster, the app pays the gas so users don't need ETH at all.
See our EIP-1559 fee market integration, paymaster solutions and layer 2 development.
Frequently Asked Questions about Gas
What is gwei?
A small unit of ETH: one gwei is 0.000000001 ETH. Gas prices are usually quoted in gwei.
Why did I pay gas for a failed transaction?
Because validators still executed the transaction up to the point where it failed. The gas pays for that work, regardless of the outcome.
What happens if I set the gas price too low?
The transaction may stay pending until the base fee drops to your maximum, or never be included. Most wallets let you speed up or cancel a pending transaction.
Does Bitcoin use gas?
No. Bitcoin has transaction fees based on the size of the transaction in bytes. Gas is specific to Ethereum and other EVM-compatible blockchains.