WASM Binary Instruction Utility

WebAssembly Binary Instruction Decoder

Decode raw WebAssembly binary instruction bytes into readable WASM mnemonics, immediate operands, LEB128 values, local and global indexes, branch depths, constants, memory alignments and offsets.

✓ Opcodes ✓ LEB128 ✓ i32 / i64 ✓ Memory ✓ Branches ✓ Locals / Globals
WASM
Instruction Stream Decoder
● Ready
Enter raw instruction bytes only. Spaces, commas, colons, hyphens and continuous hexadecimal are accepted. The default sample is loaded automatically by JavaScript.
Sequence mode continues until all supplied bytes are decoded.
Decoder scope: this tool decodes a raw WebAssembly instruction stream. It does not parse the WASM module header, sections, function bodies or validation context. Immediate integer operands use WebAssembly’s LEB128 representation where applicable.
WebAssembly Decode Result Decoded
Decoded Instruction Stream
Instructions
Input Bytes
First Opcode
First Instruction
Control Instructions
Memory Instructions
Numeric Instructions
Bytes Consumed
Instruction Listing
Byte-by-Byte Breakdown

What Is a WebAssembly Binary Instruction?

WebAssembly instructions are encoded as compact binary opcodes followed by zero or more immediate operands. A WebAssembly function body is ultimately represented as a sequence of these instruction bytes.

Many integer immediates and indexes use LEB128 encoding, which allows small values to occupy fewer bytes than a fixed-width integer representation.

WebAssembly Opcode Examples

Opcode Instruction Immediate
0x0BendNone
0x0CbrLabel index
0x0Dbr_ifLabel index
0x10callFunction index
0x20local.getLocal index
0x21local.setLocal index
0x23global.getGlobal index
0x28i32.loadmemarg
0x36i32.storememarg
0x41i32.constSigned LEB128
0x42i64.constSigned LEB128
0x6Ai32.addNone

LEB128 in WebAssembly

LEB128 is a variable-length integer representation. Seven data bits are stored per byte, while bit 7 indicates whether another byte follows.

Example: 2A Binary: 00101010 High continuation bit: 0 Unsigned value: 42

i32.const

The i32.const instruction uses opcode 0x41 followed by a signed LEB128 32-bit integer.

41 2A 41: i32.const 2A: 42 Decoded: i32.const 42

i64.const

i64.const uses opcode 0x42 and a signed LEB128 64-bit immediate. This allows both small and large signed 64-bit constants to be encoded compactly.

Local and Global Instructions

Instructions such as local.get, local.set, local.tee, global.get and global.set are followed by unsigned LEB128 indexes.

20 03 0x20: local.get 0x03: local index 3 Decoded: local.get 3

WebAssembly Memory Arguments

Load and store instructions include a memory argument containing alignment and offset values. Both values are encoded as unsigned LEB128 integers.

28 02 10 0x28: i32.load alignment exponent: 2 offset: 16 Decoded: i32.load align=4 offset=16

The alignment immediate stores an exponent, so an encoded value of 2 represents 2² = 4-byte alignment.

Control Flow Instructions

WebAssembly uses structured control flow with block, loop, if, else and end instructions. Branch instructions such as br and br_if reference a relative label depth rather than a raw machine-code address.

WebAssembly Numeric Instructions

Numeric opcodes cover integer and floating-point comparisons, arithmetic, bitwise operations, shifts, conversions and reinterpretations.

41 2A 41 08 6A Decoded: i32.const 42 i32.const 8 i32.add

WebAssembly Binary Instruction Decoder FAQs

What does opcode 0x41 mean in WebAssembly?
Opcode 0x41 is i32.const and is followed by a signed LEB128 i32 immediate.
What does opcode 0x42 mean?
Opcode 0x42 is i64.const followed by a signed LEB128 64-bit integer.
What does opcode 0x6A mean?
0x6A is the WebAssembly i32.add instruction.
What is LEB128?
LEB128 is a variable-length integer encoding used extensively by the WebAssembly binary format.
Does this decoder parse complete .wasm modules?
No. It focuses on raw instruction bytes. Module sections and function-body framing require a complete WebAssembly module parser.
How are memory offsets encoded?
Load and store memory arguments contain unsigned LEB128 alignment and offset values.
What does WebAssembly end opcode 0x0B do?
The end instruction terminates a structured expression such as a block, function expression or conditional construct.

Decode Raw WebAssembly Instructions

Inspect WASM instruction bytes from disassemblers, compiler output, browser tools, runtime traces and binary analysis with opcode, LEB128 and immediate operand decoding.

Scroll to Top