Smart Contract ABI Decoder

Paste a Solidity ABI to list every function selector, event topic and custom error, then decode transaction calldata into typed arguments in your browser.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Smart Contract ABI Decoder?

The Smart Contract ABI Decoder reads a contract ABI (the JSON array solc, Hardhat or Foundry produce, or an artifact file with an "abi" field) and lists every function with its 4-byte selector, every event with its 32-byte topic0, and every custom error with its selector. Tuples are expanded into canonical signatures such as swap((address,uint256)[],bytes), which is the exact string the selector is hashed from.

Paste transaction input data into the optional Calldata box and the tool matches its first four bytes to a function in the ABI and decodes the arguments. It handles addresses (shown with EIP-55 checksums), bool, intN and uintN as exact decimal strings, bytesN, dynamic bytes and string, fixed and dynamic arrays and nested tuples, following the offsets the ABI spec uses for dynamic types.

Everything runs in your browser with Keccak-256 from crypto-js. It decodes function inputs only: return data, event logs and revert data are not decoded, and a selector that is not in your ABI is reported rather than guessed.

  • Selectors for functions and custom errors
  • Event topic0 hashes
  • Calldata decoding for static and dynamic types, arrays and tuples
  • EIP-55 checksummed addresses and exact BigInt integers
  • Accepts plain ABI arrays and compiler artifacts
  • Runs in your browser, nothing uploaded
Read the guide: Decoding Ethereum Transactions: RLP, Selectors and ABI Calldata

Updated

How to use the Smart Contract ABI Decoder

  1. Paste the ABI JSON into the ABI Input box. A full compiler artifact with an abi field also works.
  2. Optionally paste transaction input data (starting 0x) into Calldata to decode.
  3. Press Decode ABI.
  4. Read the Decoded Analysis box: decoded calldata first, then the summary, then functions, events and errors with their selectors and topics.
  5. Use the copy button to take the whole report.

Worked examples

Decoding an ERC-20 transfer

Input

ABI with transfer(address to, uint256 amount); calldata 0xa9059cbb0000...5aaeb6053f3e94c9b9a09f33669435e7ef1beaed0000...000f4240

Output

Function transfer(address,uint256), selector 0xa9059cbb, to (address): 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed, amount (uint256): 1000000

1000000 is in the token's base units. For a 6-decimal token like USDC that is exactly 1 token; for an 18-decimal token it is a tiny fraction.

Event topic for Transfer

Input

event Transfer(address indexed from, address indexed to, uint256 value)

Output

0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

This is the topic0 you filter on in eth_getLogs. The indexed keyword does not change the hash.

Background and insight

A function selector is the first four bytes of keccak256 of the canonical signature: the function name followed by the comma-separated parameter types, with no spaces and no parameter names. transfer(address,uint256) hashes to 0xa9059cbb... so every ERC-20 transfer call starts with those bytes. Aliases must be expanded first, uint to uint256 and int to int256, which is a common reason a hand-computed selector does not match. Events use the full 32-byte hash as topic0, so Transfer(address,address,uint256) is 0xddf252ad...b3ef on every ERC-20 and ERC-721 contract.

After the selector, arguments are packed in 32-byte words. Static types (address, uint256, bool, bytes32, fixed-size arrays of static types) sit in place. Dynamic types (bytes, string, T[]) put an offset in their head slot that points to where the data starts, relative to the start of the arguments, and the data begins with a 32-byte length. Four selector bytes plus a multiple of 32 bytes is the normal calldata length, so anything else hints at truncation or packed encoding.

Selectors are only four bytes, so collisions exist: different signatures can share one. That is why decoding against the actual contract ABI is safer than looking selectors up in a public signature database, which can only say what a selector might be.

Common use cases

  • Reading what a transaction does

    Decode the input data from an explorer or wallet prompt against the verified contract ABI before signing.

  • Building log filters

    Get the topic0 for an event to use in eth_getLogs, a subgraph or an indexer config.

  • Matching revert data

    Find which custom error selector a failed call returned by comparing its first four bytes to the error list.

  • Checking an ABI change

    Confirm that a refactor did not change a function signature, and so its selector, that off-chain code depends on.

Tips and limitations

  • If no function matches, the calldata may be for a proxy's implementation. Use the implementation contract's ABI, not the proxy's.
  • uint256 values are shown as exact decimal strings. Apply the token's decimals yourself before reading them as amounts.
  • Parameter names do not affect selectors, so renaming an argument is safe; changing a type is not.
  • Calldata that is not 4 + 32n bytes long often means it was cut off when copying.
  • Overloaded functions (two transfer functions with different inputs) get different selectors and both appear in the list.

Sources and further reading

  1. Contract ABI Specification, Solidity documentation. Function selectors, head and tail encoding, and event topics
  2. ERC-20: Token Standard, Ethereum Improvement Proposals. The transfer function and Transfer event
  3. ERC-721: Non-Fungible Token Standard, Ethereum Improvement Proposals

Frequently asked questions

How is a Solidity function selector calculated?

It is the first four bytes of the Keccak-256 hash of the canonical signature, such as transfer(address,uint256). Use full type names (uint256, not uint), no spaces and no parameter names. Tuples are written as their component types in parentheses. The ABI decoder shows the selector beside every function.

How do I decode transaction input data with an ABI?

Paste the contract ABI, paste the input data into the Calldata box and press Decode ABI. The first four bytes are matched to a function selector, and the remaining 32-byte words are decoded into typed arguments, following offsets for strings, bytes and arrays.

Why does my calldata say no function has this selector?

The ABI you pasted does not contain the function that was called. Common causes are a proxy contract, where the logic lives in a separate implementation, a call to a different contract than you assumed, or an outdated ABI. Fetch the verified ABI for the actual target.

What is the difference between an event topic and a function selector?

An event topic0 is the full 32-byte Keccak-256 hash of the event signature, while a function selector is only the first 4 bytes of the hash. Indexed event parameters go in further topics, and the rest are ABI-encoded in the log data.

How are dynamic types like string and bytes encoded in calldata?

Dynamic types store an offset in their head slot instead of the value. The offset points to a 32-byte length followed by the data, padded to a multiple of 32 bytes. Dynamic arrays work the same way, with the element count as the length.

Can two different functions have the same selector?

Yes, because four bytes give only about 4.3 billion values, and collisions have been found deliberately. The Solidity compiler refuses to compile a contract with two clashing selectors, but across contracts they can repeat, so decode against the real ABI rather than a lookup database.

Is there an in-depth guide to the Smart Contract ABI Decoder?

Yes. “Decoding Ethereum Transactions: RLP, Selectors and ABI Calldata” covers the background, how it works, common pitfalls and worked examples. Read the full guide.