Ethereum • Gas Fees • EIP-1559 • Layer 2

Gas, Gas Price and Gas Limit

Gas is how Ethereum measures computation. This updated guide explains gas units, gas limit, Gwei, base fee, priority fee, max fee, failed transactions, Layer 2 fees and blob gas.

What Is Gas?

Gas is the unit Ethereum uses to measure the computational work required to perform an operation. Every transaction needs gas because validators and network nodes must process, verify and store the result of the transaction.

Simple ETH transfers, token transfers, NFT minting, decentralized exchange swaps, smart contract deployment and smart contract interaction all require gas. The more complex the operation, the more gas it usually consumes.

Simple idea: Gas measures work. ETH pays for that work. Gwei is the small ETH unit commonly used to quote gas fees.
1

Gas Unit

A measurement of computation required by an Ethereum operation.

2

Gas Fee

The ETH amount paid for using Ethereum block space and computation.

3

Gas Limit

The maximum amount of gas a transaction is allowed to consume.

Gwei and ETH

Gas prices are usually displayed in Gwei. Gwei is a small unit of ETH.

Gwei Conversion
1 ETH = 1,000,000,000 Gwei
1 Gwei = 0.000000001 ETH

Gwei makes gas fees easier to read. For example, saying a transaction uses a price of 10 Gwei per gas unit is easier than saying 0.000000010 ETH per gas unit.

Old Gas Price Model vs Current Fee Model

Older Ethereum tutorials often explained gas using only gas price and gas limit. That was correct before the London upgrade and EIP-1559.

Modern Ethereum uses a more detailed fee model. Instead of a simple gas price paid entirely to miners, Ethereum now uses a base fee, priority fee and max fee. Also, Ethereum no longer uses Proof-of-Work mining; it uses validators under Proof of Stake.

Topic Older Explanation Modern Ethereum Explanation
Who processes blocks? Miners Validators under Proof of Stake
Fee model Gas used × gas price Gas used × (base fee + priority fee)
Who receives the fee? Miner receives the gas fee Base fee is burned; priority fee goes to validator
User control User sets gas price User sets max fee and priority fee; wallet often estimates them

On mobile, swipe the table horizontally if needed.

Base Fee

The base fee is the minimum fee per gas unit required for a transaction to be included in a block. It is calculated by the Ethereum protocol, not manually chosen by users.

The base fee adjusts automatically according to network demand. If blocks are more full than the target level, the base fee rises. If blocks are less full, the base fee falls. The base fee is burned, meaning it is removed from circulation rather than paid to validators.

Current Ethereum Fee Formula
Transaction fee = gas used × (base fee + priority fee)

Priority Fee and Max Fee

The priority fee is a tip paid to validators. It gives validators an incentive to include a transaction sooner, especially when the network is busy.

The max fee is the highest amount per gas unit a user is willing to pay. It must cover the base fee and priority fee. If the max fee is higher than the actual required amount, the unused difference is refunded to the sender.

B

Base Fee

Set by protocol and burned after the transaction is included.

P

Priority Fee

A tip to validators for faster inclusion.

M

Max Fee

The highest total price per gas unit the sender is willing to pay.

Modern Ethereum gas fees are not just “gas price.” They are mainly base fee, priority fee and max fee.

Gas Limit

The gas limit is the maximum number of gas units a transaction is allowed to consume. It prevents a transaction from using unlimited resources.

A simple ETH transfer normally requires 21,000 gas units. Smart contract interactions require more because they run code, read data, write state and may call other contracts.

Too Low

The transaction can run out of gas and fail, while still consuming gas for the work already attempted.

Too High

The transaction does not automatically spend the full limit. Unused gas is normally refunded.

Wallet Estimate

Most wallets and developer tools estimate the gas limit automatically.

Smart Contracts

Complex contracts require more gas than simple transfers.

Updated Fee Examples

The following examples show how Ethereum gas fees are calculated under the modern fee model.

Example 1: Simple ETH Transfer

Gas used: 21,000
Base fee: 10 Gwei
Priority fee: 2 Gwei

Total Fee

21,000 × (10 + 2) Gwei = 252,000 Gwei = 0.000252 ETH

Example Calculation
gas used = 21,000
base fee = 10 Gwei
priority fee = 2 Gwei

total fee = 21,000 × 12 Gwei
total fee = 252,000 Gwei
total fee = 0.000252 ETH

Example 2: Smart Contract Interaction

A smart contract call may use 100,000 gas or more. If the base fee is 15 Gwei and the priority fee is 2 Gwei, then:

Smart Contract Example
gas used = 100,000
base fee + priority fee = 17 Gwei

total fee = 100,000 × 17 Gwei
total fee = 1,700,000 Gwei
total fee = 0.0017 ETH

What Happens If a Transaction Fails?

A failed Ethereum transaction can still consume gas. This happens because validators and nodes still perform computation to execute and validate the transaction attempt.

For example, if a smart contract condition fails, the transaction may revert. The state change is undone, but gas used during execution is still charged.

  • !Failed transactions do not always mean zero cost.
  • !If the gas limit is too low, the transaction may run out of gas.
  • !If a contract reverts, the state change is reversed but gas may still be consumed.

Layer 2 Gas and Blob Gas

Many users now interact with Ethereum through Layer 2 networks such as rollups. Layer 2 networks process transactions outside Ethereum mainnet and then post data or proofs back to Ethereum. This can make transactions cheaper while still inheriting Ethereum security in different ways.

After the Dencun upgrade, Ethereum introduced EIP-4844, also known as proto-danksharding. This introduced temporary data blobs for rollups. Blob space is priced separately from normal execution gas and is designed to make rollup data posting cheaper.

L2

Layer 2 Gas

Fees paid on a rollup for execution and settlement-related costs.

B

Blob Gas

Separate fee market for temporary blob data used mainly by rollups.

D

Dencun Upgrade

Introduced cheaper rollup data availability through EIP-4844 blobs.

Modern Ethereum fee learning should include mainnet gas, Layer 2 gas and blob gas, because many users now transact through rollups.

Best Practices for Users and Developers

  • Let trusted wallets estimate gas settings unless you know exactly what you are changing.
  • Use testnets before deploying or interacting with new smart contracts.
  • Check network congestion before sending urgent or expensive transactions.
  • Use Layer 2 networks when suitable to reduce fees.
  • Developers should optimize smart contract code to reduce unnecessary gas usage.
  • Always keep enough ETH for fees when using Ethereum or Ethereum-compatible networks.

Important Safety Reminder

Gas fee settings affect cost and transaction speed. They do not protect you from scams, wrong addresses, malicious contracts or risky tokens. Always verify the recipient, contract and network before confirming a transaction.

Summary

  • Gas measures the computational work required by Ethereum transactions.
  • Gwei is the unit commonly used to quote gas prices.
  • Modern Ethereum uses base fee, priority fee and max fee after EIP-1559.
  • The base fee is burned, while the priority fee goes to validators.
  • The gas limit prevents a transaction from consuming unlimited gas.
  • Failed transactions may still cost gas because computation was performed.
  • Layer 2 networks and blob gas are important for understanding modern Ethereum fees.

Continue Learning