WebAssembly Value Types Reference

Wasm i32, i64, f32, f64, v128, funcref, externref types with encoding

Reference for WebAssembly core value types — i32, i64, f32, f64, the v128 SIMD vector, and the funcref/externref reference types — with binary opcode, bit width, JavaScript mapping and SIMD lane counts.

How many value types does core WebAssembly have?

Seven: four number types (i32, i64, f32, f64), one vector type (v128, from the SIMD proposal), and two reference types (funcref, externref). i32 and i64 are integers with no inherent signedness; instructions decide whether a value is treated as signed or unsigned.

WebAssembly has a deliberately tiny set of value types. This reference lists each one with its single-byte binary encoding, bit width, JavaScript mapping and — for v128 — the SIMD lane layouts.

How it works

Value types appear in the binary format’s type section and in function signatures. Each is encoded as one byte:

0x7F  i32        0x7E  i64
0x7D  f32        0x7C  f64
0x7B  v128       0x70  funcref
0x6F  externref

The four number types are split into integers (i32, i64) and IEEE-754 floats (f32, f64). Integers carry no signedness — i32.div_s vs i32.div_u decides interpretation per instruction. The vector type v128 holds 128 bits reinterpreted as lanes by SIMD instructions. The two reference types are opaque handles: funcref to a Wasm function, externref to a host value.

JavaScript boundary

When Wasm functions are called from JS, types map as:

  • i32, f32, f64Number
  • i64BigInt (a 53-bit Number cannot hold 64 bits exactly)
  • funcref → a JS function (or null)
  • externref → any JS value passed through unchanged
  • v128 → cannot cross the JS boundary directly; it is internal to Wasm SIMD code

Keep this in mind when wiring imports and exports — passing a plain Number where an i64 is expected throws a TypeError.