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

  1. 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.

  2. 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

  3. 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).

  4. Unused gas comes back

    If the transaction needs less than its limit, the unused gas is returned to the sender.2

  5. 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

  6. The block fills up

    Validators pack transactions into a block until the block gas limit is reached.3 See Block.

Worked examples

Example 1 — A transfer with a generous limit

Fee 0.000252 ETH

Hypothetical: 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.

Example 1 — A transfer with a generous limit — calculation
Unused gas returned50,000 − 21,000 = 29,000
Price per unit10 + 2 = 12 gwei
Fee paid21,000 × 12 = 252,000 gwei
Fee in ETH0.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 failed

Hypothetical: 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.

Example 2 — Out of gas — calculation
Gas consumed80,000 (all of it)
Price per unit20 + 1 = 21 gwei
Fee lost80,000 × 21 = 1,680,000 gwei
Fee in ETH0.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.

Example 3 — Inside a full block — calculation
Target per block60m ÷ 2 = 30m gas
Max simple transfers60,000,000 ÷ 21,000 ≈ 2,857
Next base fee20 × 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

AspectWhat it controlsWho sets it
Transaction gas limitMost gas units one transaction may useThe sender (wallet suggests)
Block gas limitMost gas all transactions in a block may useValidators and network upgrades
Base feePrice per gas unit, burnedThe protocol
Priority feeTip per gas unit to the validatorThe sender
Max feeCap on base fee plus tip per unitThe 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

Think of the gas limit as the size of the fuel tank you give a transaction. A simple transfer needs 21,000 units; a token swap needs more.2 If the tank runs dry midway, the trip is cancelled but the fuel already burned is gone.2

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

  1. 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.

  2. 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.

  3. Expecting a refund on failure

    A transaction that runs out of gas still pays for the work done before it stopped.

  4. 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.

Q1You set a gas limit of 100,000 and the transaction uses 65,000. How much gas is returned?
Q2A transaction runs out of gas during execution. What happens?

Key points to remember

  1. The transaction gas limit caps how many gas units one transaction may use.
  2. A plain ETH transfer uses 21,000 gas.
  3. Total fee = gas used × (base fee + priority fee).
  4. Out-of-gas transactions revert but still pay for the work done.
  5. The block gas limit caps total work per block; the target is half of it.

Frequently asked questions

What gas limit should I use for sending ETH?

A plain ETH transfer to a regular address uses 21,000 gas.2 For contract calls, use the wallet's estimate.

Does a higher gas limit make my transaction faster?

No. Speed depends on the priority fee and the max fee you offer, not on the gas limit.2

Who decides the block gas limit?

Validators can adjust it gradually through consensus, and network upgrades can also change it.32

Further learning

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.

  1. ethereum.org. Transactions (opens in a new tab) Checked .
  2. ethereum.org. Ethereum gas and fees: technical overview (opens in a new tab) Checked .
  3. ethereum.org. Blocks (opens in a new tab) Checked .
  4. 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.