Back to Glossary
IntermediateTechnology

Gas Limit

Definition

The maximum amount of gas units a user is willing to spend on a single transaction on Ethereum. If a transaction requires more gas than the limit allows, it fails and reverts, but the gas spent up to that point is still consumed. Setting the gas limit too low causes failed transactions; setting it appropriately prevents runaway costs from buggy contracts.

Example

A simple ETH transfer needs 21,000 gas, so setting a gas limit of 21,000 is sufficient. A complex DeFi transaction might need 300,000 gas — setting the limit to 200,000 would cause it to fail.

Related Terms