ABI Encoder/Decoder

Encode and decode Ethereum ABI data

Encode ABI Parameters


Decode ABI Parameters


1. What is ABI Encoding?

ABI (Application Binary Interface) encoding is how Ethereum encodes data for smart contract interactions. It converts function parameters into hexadecimal data that can be included in transactions.

2. How does it work?

ABI encoding follows strict rules to pack typed data into bytes. Each parameter type has specific encoding rules: fixed-size types like uint256 occupy 32 bytes, dynamic types like strings include length prefixes, and arrays are encoded with their length followed by elements. The encoding ensures deterministic and efficient data representation.

Common Types

  • address: Ethereum address (20 bytes)
  • uint256: Unsigned 256-bit integer
  • string: UTF-8 string
  • bytes: Dynamic byte array
  • bool: Boolean (true/false)

3. Examples

Encode transfer parameters

Types: address,uint256
Values: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  1000000000000000000
→ Encodes recipient address and amount (1 ETH in wei)

References