Independent market intelligence
Research over noise · Risk before return
Blockchain guide

Ethereum gas fees explained: how to calculate what you pay

Gas measures the work a transaction uses. To check the fee for an included Ethereum transaction, multiply the gas used by the price actually paid per unit. An archived transfer shows where to find both values.

In simple terms

Before you sign, check the wallet’s estimated fee and the maximum execution fee. After the transaction enters a block, find its receipt by TxID and multiply Gas Used by Effective Gas Price. The result is the execution fee for the type-2 transaction shown here.

On this page
01

What gas measures

Gas is a unit for measuring the resources Ethereum charges to execute a transaction. Gas Used is a quantity of work. A price in gwei per unit tells you how much each unit costs. Their product is a fee in ETH after you convert the units.

02

Gas Limit and Gas Used

Gas Limit caps how many units the transaction can use. Gas Used comes from the receipt after execution. The simple ETH transfer in this guide used 21,000 units. Calls to smart contracts can consume a different amount.

Gas limit
Gas Limit
Max fee per gas
Max Fee per Gas
Gas used
Gas Used
Effective gas price
Effective Gas Price
Compare quantity in gas units and price per unit, before signing and after inclusion.
03

ETH, gwei, and wei

A gwei is one billion wei and one billionth of an ETH. Explorers often display a per-unit price in gwei and a total fee in ETH. Keep the units consistent when multiplying.

1 ETH = 10⁹ gwei = 10¹⁸ wei
1 gwei = 10⁹ wei

04

How the base fee works

Each block has a Base Fee per unit of gas. The protocol adjusts it according to how the previous block’s gas use compares with its target. For the gas charged to an included transaction, the base-fee portion is burned.

05

The tip and the two price caps

The Priority Fee is the tip per unit paid to the block’s fee recipient. Max Priority Fee per Gas limits that tip. Max Fee per Gas limits the total price per unit, including the base fee. The base fee can leave room for only part of the requested tip.

06

The formula for a type-2 transaction

For a block to include the transaction, its base fee must fit within the total price cap. The actual tip per unit is the smaller of the tip cap and the difference between the price cap and the base fee. Add the base fee and the actual tip to get the effective price. Multiply that price by the gas used.

Max fee per gas ≥ Base fee per gas
Actual tip per gas = min(Max priority fee per gas, Max fee per gas − Base fee per gas)
Effective gas price = Base fee per gas + Actual tip per gas
Execution fee = Gas used × Effective gas price

07

Read the fields of a real ETH transfer

This archived transaction sent 2 ETH on Ethereum Mainnet. The table separates the fields set when the transaction was signed from the values observed at inclusion and execution. The date is the block timestamp in UTC.

Archived Ethereum transfer
FieldRecorded value
Network and TxIDEthereum Mainnet
0xa31ec3035f57e3d2876fda6019cc69ed5e97e08c58503cbc8245211840592ec8
Block23,168,315
Block time (UTC)
Execution statusSuccess
Amount transferred2 ETH
Gas limit21,000 gas
Gas used21,000 gas
Base fee per gas0.568250545 gwei
Actual tip per gas2 gwei
Max priority fee per gas2 gwei
Max fee per gas2.889932954 gwei
Effective gas price2.568250545 gwei
Execution fee0.000053933261445 ETH

Open the transaction ↗

08

Split the fee into two parts

Multiply the gas used by the base fee per unit to get the ETH burned. Multiply the same gas quantity by the actual tip per unit to get the priority payment. Adding the two amounts gives the execution fee for this transfer.

21000 gas × 2568250545 wei/gas = 53933261445000 wei

Base fee burned
0.000011933261445 ETH
Priority payment
0.000042 ETH
The bar shows the shares of the actual execution fee. The amount transferred is recorded separately.
09

Why the fee ceiling is higher

Gas Limit times Max Fee per Gas gives the ceiling for the execution fee of a type-2 transaction. It excludes the ETH being sent. The final fee uses the gas charged and the effective price. In this transfer, all 21,000 units were used, so the gap comes entirely from the lower price per unit.

Execution fee ceiling = Gas limit × Max fee per gas

Execution fee ceiling
0.000060688592034 ETH
Difference from the ceiling
0.000006755330589 ETH
10

What changes as the base fee rises

The following illustration keeps the caps at 30 gwei total and 2 gwei for the tip, with 21,000 gas used when the transfer is eligible. A base fee of 20 gwei leaves room for the full tip. At 29 gwei the tip is clipped to 1 gwei. At 31 gwei the transaction is ineligible for that block.

Illustration with fixed caps

Full tip

Base fee per gas
20 gwei
Actual tip per gas
2 gwei
Effective gas price
22 gwei
Execution fee
0.000462 ETH

Reduced tip

Base fee per gas
29 gwei
Actual tip per gas
1 gwei
Effective gas price
30 gwei
Execution fee
0.00063 ETH

Base fee above cap

Base fee per gas
31 gwei
Execution fee
Ineligible for this block
In this illustration only the base fee changes. No execution fee is charged in a block that cannot include the transfer.
11

Why transactions use different amounts of gas

A token transfer or a swap can execute contract code, read or write data, and call other contracts. The path taken can depend on the current state. A wallet’s gas estimate simulates execution with available state. The receipt records what was charged after inclusion.

12

Why a failed transaction can cost gas

A transaction included in a block can revert during execution. Ethereum still charges for the gas used, and an out-of-gas failure can use the entire gas limit. A transaction rejected before inclusion has no on-chain execution fee.

13

Check the wallet before signing

Verify Ethereum Mainnet, the recipient, and the amount. Read the estimated fee and any separate maximum shown by the wallet. For a standard ETH transfer the sender needs funds for the value and the maximum execution cost. Recheck the estimate if you change the operation or network.

14

Check the receipt after inclusion

Open the TxID in the explorer for the selected network. Verify the block and status, then read Gas Used and Effective Gas Price. Some explorers call the latter Gas Price in the executed record. Use the receipt’s effectiveGasPrice if the explorer also displays a maximum price.

15

Layer 2 fees and platform withdrawal fees

A Layer 2 network can charge an execution fee, a data fee, and other components according to its own rules. Read the total and the breakdown for that network. A platform can set a separate withdrawal charge. The on-chain receipt shows network charges for the transaction.

16

How we checked this example

We matched the transaction hash, block, and fee fields in Blockscout and Etherscan. We multiplied exact integer values in wei before converting to ETH. The historical example explains the calculation at inclusion. A wallet estimate for a new transaction depends on the current state and fees.

Frequently asked questions

How many gwei are in one ETH?

One ETH equals 1,000,000,000 gwei. A gwei also equals 1,000,000,000 wei.

Do I pay Gas Limit times Max Fee per Gas?

That product is the execution-fee ceiling for type 2. The actual fee uses Gas Used and Effective Gas Price.

Does a higher Max Fee guarantee faster inclusion?

It can leave more room for the base fee and tip. Timing also depends on the block, other transactions, and the sender’s nonce.

Does an ERC-20 transfer always use 21,000 gas?

The 21,000 units here are for this simple ETH transfer. A token transfer runs contract code and its gas use can vary.

Do I pay if the status says Failed?

If the transaction was included and execution failed, the receipt can still record gas charged. Check the block, status, and transaction fee together.

Can I use the same formula for a total Layer 2 fee?

It can describe the execution portion where the network uses those fields. Read the network’s fee breakdown to account for data and other charges.

Primary sources

Created by the MyProfitFactor editorial team.

Copying or republication without attribution and an active link to the original material is prohibited. Usage policy.