WebAssembly Binary Module
Portable, sandboxed stack-machine binary bytecode format (`\0asm` v1) structured as a sequence of LEB128-framed Type, Import, Function, Memory, Export, and Code sections.
Leading null byte `0x00` prevents accidental interpretation as UTF-8 text; section lengths use unsigned LEB128 variable-length integers so parsers skip massive Code sections in O(1).
Drop any .wasm file (even 100 GB+) to inspect locally
Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded
.wasm Magic Bytes & Header Offset Map
'\0asm' magic + uint32_le binary version 1
| Byte Offset | Length | Data Type | Field Name | Engineering Description |
|---|---|---|---|---|
| 0x00 - 0x03 | 4 B | uint8[4] | magic | 0x00 0x61 0x73 0x6D ('\0asm') |
| 0x04 - 0x07 | 4 B | uint32_le | version | Binary format version (1) |
| 0x08+ | var | u8+leb128 | sections | Section ID (0..12) + LEB128 byte length + payload |
.wasm Security & Polyglot Risk Matrix
Audit the Import section (id=2) before instantiating untrusted .wasm plugins to verify they only bind approved WASI/host capabilities, and enforce fuel/epoch CPU limits.
Read .wasm Header & Metadata Without Heavy Dependencies
import struct, sys
with open(sys.argv[1], "rb") as f:
magic, ver = struct.unpack("<4sI", f.read(8))
assert magic == b"\x00asm" and ver == 1
print(f"Valid WebAssembly binary v{ver}")Deterministic .wasm Sample Files & Edge Cases
minimal-add.wasm
41-byte valid WASM v1 binary exporting `add(i32, i32) -> i32`, directly instantiable via `WebAssembly.instantiate()`.
curl -fsSL https://fileformat.co/fixtures/v1/wasm/minimal-add.wasm -o minimal-add.wasm \
&& echo "f61fd62f57c41269c3c23f360eeaf1090b1db9c38651106674d48bc65dba88ba minimal-add.wasm" | shasum -a 256 -cenv-import-memory.wasm
Contains Type, Import, Function, Memory, Export, and Code sections for symbol scanner tests.
curl -fsSL https://fileformat.co/fixtures/v1/wasm/env-import-memory.wasm -o env-import-memory.wasm \
&& echo "f6462abef751b355d056c266a6e5d376afb018bd445477af9d9df333fa0f4f47 env-import-memory.wasm" | shasum -a 256 -ctruncated-code-section.wasm
WASM binary whose Code section LEB128 byte length exceeds remaining file bytes.
curl -fsSL https://fileformat.co/fixtures/v1/wasm/truncated-code-section.wasm -o truncated-code-section.wasm \
&& echo "a43778279d60ece37b28759e01fc505e73e18e6274db914e148bd8bfdd8b295d truncated-code-section.wasm" | shasum -a 256 -cRelated Specifications & Alternatives
ZIP-compressed iOS/iPadOS application distribution archive structured around `Payload/<AppName>.app/Info.plist` (`bplist00`) and Mach-O ARM64 binaries.
Google Play publishing format packaging `BundleConfig.pb`, Protocol-Buffer encoded `base/manifest/AndroidManifest.xml`, and DEX bytecode inside a modular ZIP container.
Cross-framework Protocol Buffers computation graph and weight format used by ONNX Runtime, TensorRT, and CoreML converters.