Gas Limit
The gas limit is the maximum amount of gas a transaction is allowed to use, set by the sender; blocks also have a gas limit that caps their total work. If a transaction runs out of gas it fails, but the fee for the work done is still paid.
Every action on Ethereum, from sending ETH to swapping tokens, costs computation, and that computation is measured in gas. Two different limits control it. Each transaction carries its own gas limit, the most work the sender is willing to pay for. Each block has a gas limit too, which caps how much work the network processes every twelve seconds. Mixing the two up, or confusing the gas limit with the gas price, is a common source of failed transactions and surprise fees. This entry explains both limits and how they fit with the Gas Fee, Gwei and the EIP-1559 fee market.
- Category
- Cryptocurrency and Blockchain
- Reading time
- 7 min
- Also called
- Block gas limit, Transaction gas limit, gasLimit
- Updated
Gas limit in plain words
A transaction's gas limit is the maximum number of gas units it may consume.1 A plain ETH transfer uses exactly 21,000 units.2
The gas limit is an amount of work, not a price. The price per unit is the base fee plus the priority fee, usually quoted in gwei, and the total fee is gas used × (base fee + priority fee).2
Each block also has a gas limit: the total gas of all transactions in the block must stay below it.3 Blocks aim for a target of half that limit and can stretch up to the full limit when demand is high.2
How the gas limit works, step by step
Your wallet estimates the work
Wallets suggest a gas limit for the action; a simple ETH transfer needs 21,000 gas.1 See Crypto Wallet.
You set the fees per unit
You choose a maximum fee per gas and a priority fee (tip); the max fee covers both the base fee and the tip.1
The EVM runs the transaction
Each step of execution uses gas until the work is done or the limit is reached.2 See Ethereum Virtual Machine (EVM).
Unused gas comes back
If the transaction needs less than its limit, the unused gas is returned to the sender.2
Too little gas means failure
If execution runs out of gas, the changes are reverted but the gas used for the work is still charged.2
Worked examples
Example 1 — A transfer with a generous limit
Fee 0.000252 ETHHypothetical: you send ETH with a gas limit of 50,000, a base fee of 10 gwei and a tip of 2 gwei. The transfer uses 21,000 gas.
| Unused gas returned | 50,000 − 21,000 = 29,000 |
| Price per unit | 10 + 2 = 12 gwei |
| Fee paid | 21,000 × 12 = 252,000 gwei |
| Fee in ETH | 0.000252 ETH |
You pay only for gas actually used, so a higher limit on a simple transfer does not raise the fee.2 One gwei is one-billionth of an ETH.2
Example 2 — Out of gas
Fee paid, swap failedHypothetical: a token swap needs 120,000 gas, but you set the limit at 80,000. The base fee is 20 gwei and the tip 1 gwei.
| Gas consumed | 80,000 (all of it) |
| Price per unit | 20 + 1 = 21 gwei |
| Fee lost | 80,000 × 21 = 1,680,000 gwei |
| Fee in ETH | 0.00168 ETH |
When execution runs out of gas, the swap is reverted but the gas supplied is consumed for the work done.1 You pay and get nothing.
Example 3 — Inside a full block
Base fee +12.5%Hypothetical: a block gas limit of 60 million, a base fee of 20 gwei, and a block that is completely full.
| Target per block | 60m ÷ 2 = 30m gas |
| Max simple transfers | 60,000,000 ÷ 21,000 ≈ 2,857 |
| Next base fee | 20 × 1.125 = 22.5 gwei |
A block above its target pushes the next base fee up, by at most 12.5% when it is completely full.2 That is how the block gas limit and the fee market interact.4
Gas limit and the fee settings
| Aspect | What it controls | Who sets it |
|---|---|---|
| Transaction gas limit | Most gas units one transaction may use | The sender (wallet suggests) |
| Block gas limit | Most gas all transactions in a block may use | Validators and network upgrades |
| Base fee | Price per gas unit, burned | The protocol |
| Priority fee | Tip per gas unit to the validator | The sender |
| Max fee | Cap on base fee plus tip per unit | The sender |
Why the gas limit matters to traders
Avoiding failed transactions
A limit set too low wastes the fee on a reverted transaction, which matters for DeFi trades in busy markets.2 See Smart Contract.
Capping the worst case
The gas limit together with the max fee per gas caps how much a transaction can cost, and anything above actual use is refunded.2
Reading congestion
Blocks fuller than their target raise the base fee for the next block, so a run of full blocks quickly makes trading more expensive.2 See Mempool.
Following network capacity
Validators can raise or lower the block gas limit, by up to 1/1024 per block, which changes how many transactions fit in each block.3 See Layer 1 and Layer 2.
Advantages and disadvantages
Advantages
- Caps the cost of a transaction in advance.
- Protects against code that would loop forever.
- Unused gas is refunded automatically.
- Block limits keep blocks a manageable size.
Disadvantages
- A limit set too low wastes the fee.
- Complex DeFi calls are hard to estimate.
- Full blocks push fees up quickly.
- Gas is charged even when a transaction fails.
Going deeper
Read as far as you need. Each level builds on the one before it.
A fuel tank for each transaction
Beginner
Limit, price and total fee
Intermediate
The gas limit sets the units; the base fee and tip set the price per unit, and the total fee is units used times that price.2 With EIP-1559 the base fee is burned and only the tip goes to the block producer.4 If you set too little gas for even the basic cost, the transaction fails at validation and uses no gas.2
Block gas limit and the target
Advanced
Under EIP-1559 the block's gas target is its limit divided by an elasticity multiplier of 2.4 The base fee moves by up to 12.5% per block depending on how far the previous block was from target.2 Validators can shift the limit by up to 1/1024 per block, and network upgrades can change it too.32 ethereum.org's blocks page, last updated on 29 October 2026, described a target of 30 million gas and a maximum of 60 million; check a live block explorer for the current value.3
Common mistakes
Confusing limit with price
The gas limit is units of work; gwei is the price per unit. Raising the limit alone does not speed up a transaction.
Cutting the limit to save fees
You only pay for gas used, so a tight limit saves nothing and risks an out-of-gas failure.
Expecting a refund on failure
A transaction that runs out of gas still pays for the work done before it stopped.
Quoting an old block limit
The block gas limit changes over time; check the date of any figure you use.
Check your understanding
Test yourself before moving on. Each answer comes with an explanation.
Key points to remember
- The transaction gas limit caps how many gas units one transaction may use.
- A plain ETH transfer uses 21,000 gas.
- Total fee = gas used × (base fee + priority fee).
- Out-of-gas transactions revert but still pay for the work done.
- The block gas limit caps total work per block; the target is half of it.
Frequently asked questions
Further learning
- Gas Fee
How the total fee is built.
- EIP-1559
Base fee, tip and the gas target.
- Gwei
The unit gas prices are quoted in.
- Ethereum Virtual Machine (EVM)
The machine that consumes the gas.
Sources
This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.
- ethereum.org. Transactions (opens in a new tab) Checked .
- ethereum.org. Ethereum gas and fees: technical overview (opens in a new tab) Checked .
- ethereum.org. Blocks (opens in a new tab) Checked .
- Ethereum Improvement Proposals. EIP-1559: Fee market change for ETH 1.0 chain (opens in a new tab) Checked .
Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.