An **opcode** is the byte (or short byte sequence) that identifies a WebAssembly instruction inside a compiled module. The WAT mnemonic you write (`i32.add`) is a human-readable name; the actual binary carries the opcode byte (`0x6A` for `i32.add`) followed by any **immediate operands** required by that instruction.
- Mnemonic ≠ opcode. `local.get` is a mnemonic; the opcode is `0x20` and a `localidx` LEB128 immediate follows.
- Opcode ≠ immediate. The opcode identifies what to do; immediates parameterize it. They are encoded separately in the binary.
- Opcode ≠ section. Some WAT forms (`module`, `func`, `start`) describe structure and are encoded via section IDs and section payloads, not via a single executable opcode.
WebAssembly uses three prefixed opcode spaces in addition to the core single-byte space. A prefixed instruction is encoded as the prefix byte followed by a u32 LEB128 sub-opcode:
- `0xFC` — bulk memory, saturating float-to-int conversions, and table extensions (`memory.copy` is `0xFC 0x0A`).
- `0xFD` — SIMD (`v128.load` is `0xFD 0x00`).
- `0xFE` — atomics and threads (`i32.atomic.load` is `0xFE 0x10`).
(module
(func (export "add") (param i32 i32) (result i32)
local.get 0
local.get 1
i32.add))The function body of the module above encodes to the following opcode sequence (locals declaration is `00` for no locals; the function body terminator is `0x0B`):
20 00 local.get 0 ; 0x20 + u32 LEB128 0
20 01 local.get 1 ; 0x20 + u32 LEB128 1
6A i32.add ; 0x6A, no immediates
0B end ; 0x0B**LEB128** is the variable-length integer encoding WebAssembly uses for indices and other integer immediates. Unsigned values use the `unsigned LEB128` form (7 bits per byte, high bit set means "more bytes follow"). Signed values use `signed LEB128`, which sign-extends from the final byte's high bit. `i32.const` carries a signed LEB128 i32; `local.get`'s index is unsigned LEB128. Small values fit in one byte; large values use up to five bytes for i32 and ten for i64.
Memory load/store instructions take a `memarg` immediate: two unsigned LEB128 values (alignment hint, then offset). `i32.load align=2 offset=0` is encoded as `28 02 00`.
When you search the instruction reference you can type a mnemonic (`i32.add`), a hex opcode (`0x6A` or `6a`), or a decimal byte value (`106`). The search index folds all three representations into each entry's tags.