Gas is the lifeblood of the Ethereum network. Just as vehicles require fuel to run, Ethereum relies on gas to power its operations.
Prerequisites
To better understand this guide, we recommend familiarizing yourself with Ethereum transactions and the Ethereum Virtual Machine (EVM).
What Is Gas?
Gas represents the computational effort required to perform specific operations on the Ethereum network. Since every Ethereum transaction consumes computational resources, users must pay fees to prevent spam attacks and infinite computational loops. These fees are paid in gas.
Gas fee = Amount of gas needed for an operation ร Cost per unit of gas
Fees are charged regardless of whether a transaction succeeds or fails. Gas fees must be paid in Ethereum's native cryptocurrency, Ether (ETH), typically denominated in gwei (1 gwei = 0.000000001 ETH or 10^-9 ETH).
๐ Learn how to optimize your gas fees
How Gas Fees Are Calculated
When submitting a transaction, you specify the maximum gas you're willing to pay. Your bid determines whether validators include your transaction in the next block. Paying too little may delay or prevent execution, while paying too much wastes ETH.
Total gas fee consists of:
- Base fee: Set by the protocol (minimum required for validity)
- Priority fee (tip): Extra incentive for validators to prioritize your transaction
Example: Jordan sends Taylor 1 ETH
- Gas units used: 21,000
- Base fee: 10 gwei
- Priority fee: 2 gwei
Total fee = 21,000 ร (10 + 2) = 252,000 gwei (0.000252 ETH)
Base Fee Mechanics
- Dynamically adjusted based on previous block congestion
- Increases by up to 12.5% per block when network is busy
- Decreases when network activity subsides
- Burned (removed from circulation) after transaction completion
| Block Number | Gas Used | Fee Increase | Current Base Fee |
|---|---|---|---|
| 1 | 15M | 0% | 100 gwei |
| 2 | 30M | 0% | 100 gwei |
| 3 | 30M | 12.5% | 112.5 gwei |
Priority Fee (Tip)
- Incentivizes validators to include your transaction
- Higher tips increase inclusion priority
- Recommended tip amounts vary by network conditions
Max Fee Per Gas
Users can set a maxFeePerGas to cap transaction costs. Any difference between this maximum and the actual (base fee + tip) gets refunded.
Why Gas Fees Exist
- Network Security: Prevents spam and DDoS attacks
- Resource Allocation: Charges for computational work
- Anti-Spam: Discourages infinite loops and wasteful computations
All unused gas gets refunded to the sender.
Gas Limit Explained
- Standard ETH transfer: 21,000 gas limit
- Smart contract interactions: Higher limits needed for complex operations
- Setting too low a limit may cause failed transactions (gas consumed but operation incomplete)
Why Gas Fees Spike
High demand causes fee competition among users. Complex dApps and smart contracts also consume more gas. Ethereum's scaling solutions aim to address these issues long-term.
Gas-Saving Strategies
- Layer 2 solutions: Arbitrum, Optimism, Polygon
- Off-peak transactions: Lower demand periods
- Gas optimization: Efficient smart contract coding
๐ Discover Layer 2 solutions for lower fees
Gas Monitoring Tools
FAQ
What's the difference between gas limit and gas price?
- Gas limit: Maximum units you're willing to consume
- Gas price: Cost per unit (base fee + priority fee)
How can I estimate gas fees before sending?
Most wallets provide fee estimates. You can also check gas trackers like Etherscan.
Why does my transaction fail but still cost gas?
Validators perform computational work regardless of success. Failed transactions still consume gas up to the point of failure.
When is the best time to send low-fee transactions?
Typically weekends or late-night hours (UTC) when network activity decreases.