Quick Definition

The maximum amount of computational work (measured in gas units) that a user is willing to pay for a blockchain transaction, preventing infinite loops and setting spending caps.

What Is Gas Limit?

The gas limit is a parameter set by users (or wallets on their behalf) that defines the maximum amount of computational effort they're willing to consume for a blockchain transaction. On Ethereum, every operation (transferring tokens, executing smart contract functions, storing data) consumes a specific number of gas units. The gas limit acts as a safety mechanism — if a transaction tries to consume more gas than the limit, it reverts, preventing users from accidentally spending unlimited fees on stuck or infinite-loop transactions.

Different operations require different gas amounts: a simple ETH transfer requires exactly 21,000 gas, a basic ERC-20 token transfer needs ~65,000 gas, and a complex DeFi operation (like a multi-hop swap through several liquidity pools) might require 200,000-500,000+ gas. The actual cost in ETH is calculated as: gas used × gas price (in gwei). Setting the gas limit too low causes transaction failure (but gas is still consumed for the computation performed); setting it too high wastes no money — only gas actually consumed is charged.

Ethereum also has a block gas limit (currently ~30 million gas per block), which determines how many transactions can fit in each block. This is a critical network parameter — increasing the block gas limit allows more throughput but requires validators to process more data, potentially increasing hardware requirements and reducing decentralization. This fundamental tension drives the development of Layer 2 scaling solutions.

Gas Limit Example

  • 1A user sets a gas limit of 21,000 for a simple ETH transfer. The transaction uses exactly 21,000 gas and succeeds. If they set the limit to 15,000, the transaction would fail (insufficient gas) — but they'd still lose the fee for the 15,000 gas consumed before the failure.
  • 2A complex DeFi transaction requires 250,000 gas. The user's wallet estimates 300,000 gas limit with a buffer. At a gas price of 30 gwei, the maximum cost is 300,000 × 30 gwei = 0.009 ETH (~$27). The transaction actually uses only 245,000 gas, so they pay 0.00735 ETH (~$22) — the unused gas is refunded.