Calculating Transaction Fees
Fee calculation is a core exam skill. This lesson explains the EIP-1559 fee market, the base fee, priority fee and max fee, how to calculate the fee a transaction pays and how legacy transactions differ.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the base fee, priority fee and max fee of EIP-1559.
- Explain how the base fee changes between blocks.
- Calculate the fee, the burned amount and the proposer's tip of a transaction.
- Explain how legacy transactions are priced.
The EIP-1559 fee market
Before the London upgrade (August 2021), each transaction offered a single gas price in a first-price auction, which made fees volatile and hard to predict. EIP-1559 introduced a protocol-set base fee per gas for every block. The following terms describe the parts of a fee.
- Base fee
- Set by the protocol for each block from the previous block's usage. It is burned, removing ether from circulation.
- Priority fee (tip)
- The extra amount per gas the sender offers the block proposer to include the transaction.
- maxPriorityFeePerGas
- The highest tip per gas the sender will pay.
- maxFeePerGas
- The highest total price per gas (base fee plus tip) the sender will pay.
- Effective gas price
- What the sender actually pays per gas: min(maxFeePerGas, baseFee + maxPriorityFeePerGas).
Parts of a fee
How the base fee moves
Each block has a gas target equal to half its gas limit. If a block uses more gas than the target, the next block's base fee rises, by up to 12.5% when the block is full; if it uses less, the base fee falls by up to 12.5%. Sustained demand therefore raises the base fee exponentially until some users stop sending, and quiet periods lower it. Because the change per block is bounded, wallets can predict the next base fee and set a max fee with headroom, commonly twice the current base fee plus the tip.
The following diagram shows the base fee changing with block fullness.

Predicting the base fee
Calculating the fee
The fee paid follows from the effective gas price.
effectiveGasPrice = min(maxFeePerGas, baseFee + maxPriorityFeePerGas)
fee = gasUsed × effectiveGasPrice
burned = gasUsed × baseFee
to proposer = gasUsed × (effectiveGasPrice − baseFee)The difference between maxFeePerGas and the effective price is never charged. If the current base fee exceeds maxFeePerGas, the transaction cannot be included until the base fee falls. Receipts report gasUsed and effectiveGasPrice, so the actual fee can always be computed afterwards.
The following diagram splits the price per unit of gas.

Calculating a fee
Legacy transactions and units
Legacy (type 0) transactions, which older material describes, have a single gasPrice field. Since London, they are treated as if both maxFeePerGas and maxPriorityFeePerGas equal gasPrice: the base fee is burned and everything above it goes to the proposer as a tip, so legacy transactions usually overpay.
Unit conversions are part of every calculation. The following table shows the units in use.
| Unit | Wei | Typical use |
|---|---|---|
| wei | 1 | All on-chain amounts |
| gwei | 109 | Gas prices |
| ether | 1018 | Balances and values shown to users |
Units and legacy prices
A complete fee calculation
A token transfer uses 51,000 gas. The block's base fee is 20 gwei; the transaction set maxPriorityFeePerGas to 2 gwei and maxFeePerGas to 50 gwei. What does the sender pay, how much is burned and how much does the proposer receive?
Effective gas price = min(50, 20 + 2) = 22 gwei. Fee = 51,000 × 22 = 1,122,000 gwei = 0.001122 ETH. Burned = 51,000 × 20 = 1,020,000 gwei = 0.00102 ETH. Proposer = 51,000 × 2 = 102,000 gwei = 0.000102 ETH. The 28 gwei per gas between 22 and the 50 gwei maximum is not charged.
When the max fee is the limit
The base fee is 45 gwei. A transaction sets maxFeePerGas to 46 gwei and maxPriorityFeePerGas to 3 gwei, and uses 21,000 gas. What is its effective gas price, and what happens if the base fee rises to 48 gwei before it is included?
At a base fee of 45 gwei, the effective price is min(46, 45 + 3) = 46 gwei: the max fee caps it, so the proposer receives only 1 gwei per gas. The fee is 21,000 × 46 = 966,000 gwei. If the base fee rises to 48 gwei, above the max fee, the transaction cannot be included and waits in the mempool until the base fee falls to 46 gwei or below, or until the sender replaces it with a higher max fee.
Base fee 10 gwei, max priority fee 3 gwei, max fee 12 gwei. What is the effective gas price?
Show answer
12 gwei: min(12, 10 + 3). The max fee caps the price, so the proposer receives only 2 gwei per gas.
Exam Tips
Remember for the exam
- Effective gas price = min(maxFeePerGas, baseFee + maxPriorityFeePerGas).
- Fee = gasUsed × effective gas price; the base fee portion is burned, the tip goes to the proposer.
- The base fee changes by at most 12.5% per block, around a target of half the block limit.
- Legacy gasPrice acts as both max fee and max priority fee.
- 1 gwei = 10^9 wei; 1 ether = 10^18 wei.