Solidity Gas Limit Estimator

Estimate gas for common EVM operations and Solidity patterns

Ad placeholder (leaderboard)

The Solidity Gas Limit Estimator lets you build up an estimate of how much gas a function will consume by listing the EVM operations it performs. It uses the post-Berlin/London gas schedule so you can set realistic gas limits and spot the operations that dominate your cost before you deploy.

How it works

Each EVM opcode has a fixed gas cost defined by the Ethereum Yellow Paper and later EIPs. The estimator multiplies the cost of each operation by how many times your function runs it, then adds the mandatory 21,000-gas base transaction cost:

total = 21000 + Σ (opcode gas cost × count)

Key costs in the built-in table (warm/cold per EIP-2929):

  • SSTORE (zero → non-zero): 22,100
  • SSTORE (update non-zero): 5,000
  • SLOAD (cold): 2,100, (warm): 100
  • ERC-20 transfer (typical): ~50,000
  • Mapping update: ~22,100 (a fresh SSTORE)
  • LOG/event emission: ~1,125 + 8 per byte
  • External CALL: ~2,600 cold + forwarded gas

Setting a safe limit and notes

Because real gas depends on warm/cold access, the path actually taken, and calldata, the tool also shows a suggested limit with a safety buffer added on top of the raw total. Use that as your transaction gas limit.

The breakdown sorts operations by total gas, so the biggest contributors rise to the top — usually storage writes. Cutting an SSTORE often saves more than optimising dozens of arithmetic opcodes. Always confirm the final number with eth_estimateGas or a testnet run before mainnet deployment.

Ad placeholder (rectangle)