ABI Encoder & Decoder
Encode and decode Solidity ABI parameters — function calls, constructor args, and raw data
Parameters
Encoded ABI Data
Understanding ABI Encoding
The Application Binary Interface (ABI) defines how Solidity functions are called at the byte level. Every smart contract interaction — from MetaMask transactions to Foundry Cast commands — uses ABI encoding to serialize function names and arguments into hex data.
Function Selectors
The first 4 bytes of calldata are the function selector — the first 4 bytes of the Keccak-256 hash of the function signature. For example, transfer(address,uint256) produces selector 0xa9059cbb. This is how the EVM knows which function to call.
How Parameters Are Encoded
ABI encoding pads each parameter to 32 bytes. Static types (address, uint256, bool) are encoded inline. Dynamic types (string, bytes, arrays) use a head-tail pattern: the head contains an offset pointer, and the actual data follows in the tail section.
Common Use Cases
- Decode transaction input data from Etherscan or block explorers
- Encode calldata for Foundry/Cast commands without writing scripts
- Debug smart contract interactions by verifying parameter encoding
- Verify constructor arguments when deploying contracts
- Build raw transactions for custom integrations
Frequently Asked Questions
▶ What is a function selector?
A function selector is the first 4 bytes of the Keccak-256 hash of the function signature. For example, keccak256("transfer(address,uint256)") = 0xa9059cbb..., so the selector is 0xa9059cbb. The EVM uses this to identify which function to execute.
▶ How do I use encoded calldata with Foundry/Cast?
Copy the full calldata from this tool and use it with: cast send <contract_address> followed by the calldata hex string. For read operations, use cast call instead. This is especially useful when you need to call functions without writing a script.
▶ What is the difference between ABI encoding and RLP encoding?
ABI encoding is used for smart contract function calls and parameter serialization. RLP (Recursive Length Prefix) encoding is used by Ethereum for serializing transactions and blocks at the protocol level. They serve different layers of the stack.
▶ Can I decode transaction data from Etherscan?
Yes. Copy the "Input Data" field from any transaction on Etherscan, paste it into the Decode tab, enter the expected parameter types, and click Decode. This works for any EVM transaction on mainnet, L2s, and testnets.
About the ABI Encoder
The ABI (Application Binary Interface) defines how smart contract functions are encoded into calldata — the raw bytes that the EVM processes. Encoding parameters correctly is essential for contract interactions and transaction decoding.
Encode function calls with their parameters to get the calldata hex string. Decode transaction input data back into readable function calls. Supports all Solidity types including uint, address, bytes, strings, and arrays.
How to use
- Enter the function signature (e.g., transfer(address,uint256)).
- Fill in the parameter values.
- Click encode to get the calldata.
- Or paste calldata to decode it back to parameters.
Frequently Asked Questions
What is ABI encoding used for? ▾
The EVM requires function calls to be encoded as raw bytes. ABI encoding converts human-readable function signatures and parameters into the hex calldata that smart contracts process.
Can I decode transaction input data? ▾
Yes — paste the input data hex from any transaction (found on Etherscan) along with the function signature to decode it back to readable parameter values.
What is ABI encoding used for? ▾
Every Ethereum contract call encodes its arguments per the ABI specification — the same bytes eth_abi.encode produces. This encoder builds them from a signature and values, matching what wallets and web3 libraries send on-chain.
Can I decode calldata I found in a transaction? ▾
Yes — paste the function signature and the 0x data; each argument decodes to its uint, address, bytes, or composite type. Useful for verifying what a pending transaction will do before signing it.
Does encoding contact a node or wallet? ▾
No — ABI encoding is pure local computation. Nothing is broadcast, and no wallet connection is needed or requested.