plain.

ABI and calldata decoder and encoder

Paste calldata and the function’s ABI or signature to read the arguments, or give the arguments and get the calldata. It works in your browser, so what you paste never leaves this page.

Examples:

Result

Selectors in this ABI

    What goes in the ABI box

    Any of these works, and you can mix several functions in one box:

    • A JSON ABI as solc, Foundry or plain writes it: a whole array, or a single function object, with nested components for tuples.
    • Human-readable lines such as function transfer(address to, uint256 amount) returns (bool), one per line. The function keyword, names and returns are optional, so a bare transfer(address,uint256) is enough.
    • Tuples written inline, as in swap((address token, uint256 amount)[] legs, string memo).

    When you decode, the first four bytes of the calldata choose the function, and the tool says so if none of the functions you pasted has that selector. The selector is the first four bytes of the Keccak-256 hash of the canonical signature, such as transfer(address,uint256). A signature written with uint instead of uint256, or with a wrong type, hashes to a different selector, which is the usual reason a decode fails.

    Types it understands

    • uint8 to uint256, int8 to int256, uint, int
    • address, shown with its EIP-55 checksum
    • bool
    • bytes1 to bytes32, bytes, string
    • Arrays: T[] and T[3], nested as deep as you like
    • Tuples and arrays of tuples

    Integers are read and written as exact big integers, so a uint256 near 2256 comes out digit for digit. When you encode, give integers as strings or JSON numbers (decimal or 0x hex), bytes as hex, and tuples as lists in the order of their fields.

    How the encoding works

    The tool follows the Solidity contract ABI specification. Every argument gets a 32-byte slot in a head. A static value, such as a number, an address or a bytes32, sits in its slot. A dynamic value, such as a string, bytes or uint256[], puts an offset in its slot, and the value itself, with its length in front, goes in the tail after the head. Tuples and fixed-size arrays are inline when everything inside them is static, and dynamic otherwise.

    As a check, the f(uint256,uint32[],bytes10,bytes) example from the specification, with 291, [1110, 1929], "1234567890" and "Hello, world!", gives the selector 0x8be65246 followed by nine 32-byte words, with the offsets 0x80 and 0xe0 in the head, and the and the “Example” button above loads it#8220;Arrays and bytesand the “Example” button above loads it#8221; button above loads it. The Keccak-256 here is the original Keccak that Ethereum uses (padding byte 0x01), not NIST’s SHA3-256, and it returns c5d24601…a470 for empty input and 0xa9059cbb as the selector of transfer(address,uint256).

    Where it stops

    • It decodes and encodes the arguments of one function call. It doesn’t decode event logs, return data from a call it can’t see, or a transaction’s outer envelope.
    • It doesn’t look selectors up in a signature database. If you only have calldata, the first four bytes tell you what to search for, and you then paste the signature you find.
    • Packed encoding (abi.encodePacked), fixed-point types and function-pointer types aren’t supported.
    • Strict decoding: values that don’t fit their type (a uint8 slot holding 300, an address with non-zero high bytes) and offsets that point past the data are reported as errors instead of being guessed at.

    It handles everything in your browser. The tool makes no network request with what you paste, and nothing is stored.

    Working on Solidity?

    plain is one small, MIT-licensed binary that compiles, tests, deploys, verifies and upgrades Solidity contracts, and runs Foundry projects as they are. Its builds write each contract’s abi and methodIdentifiers, and a failing test prints the decoded revert reason, custom errors included.

    See what plain does