Work out the gas cost of Ethereum calldata

Estimate the data-byte gas and fee for Ethereum calldata at a chosen gas price.

freeworks offlinenothing uploaded
ToolEthereum Calldata Cost
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Hex calldata is decoded into bytes, zero and non-zero bytes are counted, and intrinsic data gas is four per zero byte plus sixteen per non-zero byte. That gas total is multiplied by the entered price and formatted in wei, gwei, and ether.

  • Twenty gwei is only a planning starting point, not a network quote.
  • The byte rates come from EIP-2028 and ignore the ABI meaning of the bytes.

Worked example

A short piece of calldata at 20 gwei
4 bytes, 2 zero and 2 non-zero, so 2*4 + 2*16 = 40 gas
Input
											Calldata hex: 0x0000abcd
Gas price gwei: 20
										
Output
												Byte count: 4
Zero byte count: 2
Non zero byte count: 2
Gas units: 40
Cost wei: 800000000000
Cost gwei: 800
Cost ether: 0.0000008
											

When to use this

Contract engineers budget transaction overhead, ABI encoders compare packed arguments, and fee dashboards model byte charges.

Edge cases

  • 0x00 costs four data gas while 0x01 costs sixteen.
  • An odd number of hex digits cannot form bytes and is rejected instead of silently padded.
  • The result excludes execution gas, the transaction base cost, and blob fees.

References