Blockchain
Gas Limit
The maximum amount of computational work (gas) that a transaction or smart contract execution is allowed to consume.
Last Updated
2026-03-19
Related Concepts
What is Gas Limit?
Gas limit is the maximum amount of computational work a user allows a transaction to perform. It acts as a safety mechanism to prevent a malfunctioning or malicious smart contract from consuming all funds in a user's wallet.
How does Gas Limit work?
- The user sets a maximum gas units value before sending.
- The EVM tracks gas usage as the transaction executes.
- If execution finishes under the limit, the user is only charged for what was used.
- If the limit is reached before completion, the transaction fails and reverts.
- The gas used up to the point of failure is not refunded.
Why does Gas Limit matter?
Gas limits protect users from unexpected costs caused by bugs like infinite loops in smart contracts. They also help the network manage block space by defining the maximum size of any single transaction.
Key features of Gas Limit
- Maximum computational units per transaction
- Safety cap for user funds
- Prevents runaway contract execution
- Unused gas is refunded to the sender
- Critical for block size management
Examples of Gas Limit
A standard ETH transfer has a fixed gas limit of 21,000. Complex DeFi swaps typically require a limit between 100,000 and 300,000 to ensure success.
