ABI Decoder & Encoder

Decode calldata and event logs, or encode function calls, using any contract ABI.

Sends only the 4-byte selector to 4byte.directory (a public, third-party service) — never your calldata or ABI.

How to use the ABI Decoder & Encoder

  1. Paste a contract ABI — JSON or human-readable signatures — into the Contract ABI box.
  2. Choose a tab: Decode Calldata, Encode Function, or Decode Event Log.
  3. Fill in the calldata, function + arguments, or topics + data for that tab, then click the action button.
  4. Copy the decoded function/event name and arguments, or the generated calldata, from the output panel.
  5. Don't have the ABI? On the Decode Calldata or Decode Event Log tab, click Look up signature online to query 4byte.directory by the selector alone. On Decode Calldata, picking a candidate fills in the ABI and decodes right away. On Decode Event Log, candidates are shown for reference — add the event to the ABI yourself, marking the correct parameters indexed, to decode it.

All three tabs share the same ABI input, so you can switch between decoding and encoding the same contract without re-pasting it.

See it in action

Many online calldata tools handle only one direction — decoding or encoding, not both from the same ABI. Here's a real round trip: encoding an ERC-20-style transfer call, then decoding the result straight back against the same ABI.

ABI:

function transfer(address,uint256) returns (bool)

Encode Function — these arguments:

["0x1234567890AbcdEF1234567890aBcdef12345678", "1000000000000000000"]

produce this calldata:

0xa9059cbb0000000000000000000000001234567890abcdef1234567890abcdef123456780000000000000000000000000000000000000000000000000de0b6b3a7640000

Decode Calldata — pasting that same calldata back in against the same ABI recovers:

{
  "functionName": "transfer",
  "args": [
    "0x1234567890AbcdEF1234567890aBcdef12345678",
    "1000000000000000000"
  ]
}

How This Tool Works

The ABI Decoder & Encoder parses the contract ABI you paste — either a JSON ABI array (as produced by solc or Etherscan) or newline-separated human-readable signatures like `function transfer(address,uint256) returns (bool)` — using the viem library, entirely in your browser.

Decode Calldata matches the calldata's 4-byte selector against every function in the ABI and decodes the remaining bytes into named arguments. Encode Function does the reverse: pick a function and supply its arguments as a JSON array to produce ready-to-send calldata. Decode Event Log matches topics and data against the ABI's events to recover the event name and its indexed and non-indexed arguments.

Your ABI, calldata, topics, and event data are never sent to a server — all parsing, decoding, and encoding happens client-side in your browser's JavaScript engine. The one opt-in exception: clicking Look up signature online sends only the calldata's 4-byte selector (or the event's 32-byte topic0 hash) to 4byte.directory, a free public signature database, so you can find a likely function or event name even without an ABI.

On the Decode Calldata tab, picking a looked-up function candidate fills in the ABI and decodes immediately, since calldata argument order is unambiguous. On the Decode Event Log tab, candidates are shown for reference only — a 4byte.directory signature string doesn't record which parameters are indexed, so it can't be safely auto-filled; you'll need to add the event to the ABI yourself, marking the correct parameters indexed.

Frequently Asked Questions

Advertisement

Related tools

Advertisement