Solidity REPL
Encoding & crypto

ABI encode and decode

Encode mixed values and decode them back into typed variables.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern when you need to check the exact bytes, selector, hash, or decoded values that Solidity will produce. The entry isolates abi encode and decode so its input, result, and state changes stay easy to compare.

Solidity to run

bytes memory data = abi.encode(uint256(42), true)
(uint256 answer, bool ready) = abi.decode(data, (uint256, bool))
data
answer
ready

What to expect

The encoded byte string is shown first, followed by the decoded uint256 value 42 and boolean value true.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about values and inspection Prototype Solidity behavior