RLP Encoder / Decoder
Encode and decode Recursive Length Prefix (RLP) data. The serialization format used by Ethereum transactions and blocks.
Examples
RLP Encoding Rules
0x00-0x7f- Single byte: encoded as itself0x80-0xb7- String 0-55 bytes: 0x80 + length, then data0xb8-0xbf- String >55 bytes: 0xb7 + length-of-length, length, then data0xc0-0xf7- List 0-55 bytes payload: 0xc0 + length, then items0xf8-0xff- List >55 bytes payload: 0xf7 + length-of-length, length, then items
How to Use This RLP Encoder / Decoder
This free online RLP encoder and decoder helps you work with Ethereum's core serialization format. Use it to encode data for protocol-level operations or decode raw RLP data from transactions and blocks.
- To encode, enter your data as a JSON-style array of hex strings and nested arrays. For example,
["0x04", ["0x01", "0x02"]]encodes a list with a single byte and a nested list. - To decode, paste RLP-encoded hex data (with or without the 0x prefix) and the tool will parse it into its nested structure, showing each element.
- Inspect the result to understand the structure, verify transaction encoding, or debug protocol-level data.
- Copy the output using the copy button for use in your scripts, tests, or protocol implementations.
All encoding and decoding runs entirely in your browser. No data is sent to any server, ensuring your transaction data stays private.
Common Use Cases
- Transaction debugging — Decode raw signed transactions to inspect nonce, gas parameters, value, and signature components (v, r, s).
- Contract address derivation — RLP-encode the sender address and nonce to compute the expected address of a contract deployed via CREATE.
- Protocol development — Test RLP encoding and decoding when implementing Ethereum clients or protocol-level tools.
- Block header parsing — Decode RLP-encoded block headers to extract parent hash, state root, timestamp, and other fields.
- State trie analysis — Decode RLP-encoded account state (nonce, balance, storageRoot, codeHash) from Patricia-Merkle trie nodes.
Related Tools
ABI Encoder / Decoder
Encode and decode Ethereum smart contract function calls using ABI specifications.
Keccak256 Hash Generator
Generate Keccak256 hashes used for Ethereum addresses, transaction hashes, and storage slots.
Hex / Decimal Converter
Convert between hexadecimal and decimal numbers for block numbers, gas values, and transaction data.
Frequently Asked Questions
What is RLP encoding in Ethereum?
RLP (Recursive Length Prefix) is the main serialization method used by Ethereum to encode nested arrays of binary data. It is used to serialize transactions, blocks, account state, and wire protocol messages. RLP only encodes structure (nested byte arrays) and leaves interpretation of the data to higher-level protocols.
How does RLP encoding work?
RLP encoding follows simple rules: a single byte between 0x00 and 0x7F is its own encoding. Strings of 0-55 bytes are prefixed with 0x80 plus the length. Longer strings use a multi-byte length prefix starting at 0xB7. Lists work similarly, with prefixes starting at 0xC0 for short lists and 0xF7 for longer lists. These rules apply recursively for nested data.
Where is RLP used in Ethereum?
RLP is used throughout Ethereum: transaction serialization before signing and hashing, block header encoding, account state encoding in the state trie, receipt encoding, and the Ethereum devp2p wire protocol. Understanding RLP is essential for working at the protocol level and for computing transaction hashes.
What is the difference between RLP and ABI encoding?
RLP encodes arbitrary nested byte arrays for protocol-level serialization (transactions, blocks, state). ABI encoding is specifically for smart contract function calls and follows a different specification with 32-byte padding, type information, and offset pointers. RLP is more compact, while ABI encoding is designed for the EVM's word-based architecture.
How do I RLP-encode an Ethereum transaction?
A legacy Ethereum transaction is RLP-encoded as a list of [nonce, gasPrice, gasLimit, to, value, data, v, r, s]. Each field is converted to its minimal byte representation, then the list is RLP-encoded. EIP-1559 transactions use a different structure prefixed with a type byte (0x02) before the RLP encoding.
Can RLP encode integers and strings?
RLP encodes raw bytes, not typed data. Integers must first be converted to their big-endian byte representation with no leading zeros. Strings must be converted to UTF-8 bytes. The RLP encoding itself does not distinguish between integers, strings, or addresses - it only sees byte sequences and nested lists.
Related Tools & Guides
Try Also
Base64 Encoder / Decoder
Encode and decode Base64 strings online. Supports text and hex input with URL-safe Base64 option for Ethereum development.
Bytes32 / String Converter
Convert between bytes32 hex, UTF-8 strings, numbers, and addresses. Visualize padding for Solidity bytes32 values.
Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal online. Supports arbitrarily large numbers with BigInt.