Free online tools to generate, calculate,
convert, format, encode, and play.
 

Calldata Cost Calculator

Calculate the gas cost of calldata bytes (zero vs non-zero) for a given hex payload.


Hex Payload

Paste raw hex bytes with or without 0x prefix
Gas costs update as you type.

Example Payloads


How It Works

Every byte of calldata included in an Ethereum transaction incurs a gas cost. The EVM charges different rates for zero and non-zero bytes:

Byte Type Gas Cost Description
Zero byte (0x00) 4 gas Each byte equal to zero in the calldata
Non-zero byte 16 gas Each byte not equal to zero in the calldata

The total calldata gas cost is calculated as:

Calldata Gas = (Zero Bytes × 4) + (Non-Zero Bytes × 16)

These costs were set by EIP-2028 (Istanbul hard fork, 2019), which reduced the non-zero byte cost from 68 to 16 gas to make calldata cheaper for Layer 2 rollups that post data to Ethereum.

Why It Matters

  • Rollup economics — L2 rollups (Optimism, Arbitrum, etc.) post compressed transaction batches as calldata. Calldata cost is their primary expense.
  • Contract optimization — Choosing function signatures and encoding that produce more zero bytes can meaningfully reduce gas costs.
  • Transaction sizing — Larger payloads (e.g., multi-call batches, NFT metadata) can become expensive. This tool helps estimate that cost upfront.

Common Calldata Sizes

Operation Typical Size Approx. Gas
Simple ETH transfer0 bytes0
ERC-20 transfer68 bytes~640
ERC-20 approve68 bytes~640
Uniswap V2 swap~260 bytes~2,800
L2 batch posting10–100+ KBvaries

Embed This Util

You can embed this util on your own site as a widget. Adding ?embed=1 to the URL loads a compact version with just the tool itself; no header, menu, or documentation. Paste this snippet into your HTML:


    

Copy snippet Adjust the height to taste.



Feedback

Help us improve this page by providing feedback, and include your name/email if you want us to reach back. Thank you in advance.


Share with