Try it Live
Run ABI examples in the interactive playground
Overview
Abi.encode encodes function calldata (selector + parameters) using a full ABI. It looks up the function by name, then encodes the arguments according to the function inputs.
Quick Start
- Abi Instance
- Explicit Function Item
Parameters Only
If you need only the parameters (no selector), useAbi.encodeParameters:
Overloads and Ambiguity
Abi.encode matches by function name. If your ABI contains overloads, select the exact function item:
Error Handling
See Also
- decode - Decode function return values
- decodeData - Decode calldata by selector
- Function.encodeParams - Function-specific encoding
- Encoding - ABI encoding rules

