Wasm
How it works
Source code in languages such as C/C++, Rust or Go compiles to a .wasm module (binary format; a human-readable text format, WAT, also exists). Before execution the module is validated and type-checked. A runtime executes instructions on an implicit operand stack — as an interpreter, JIT or AOT. The module operates on an isolated linear memory and has no default access to system resources; it communicates with the outside world only through explicitly imported host functions: in the browser via JavaScript and Web APIs, and outside it via the WASI interface, which grants permissions under a capability-based model.
Problem solved
The web needed a fast, safe and portable compilation target for languages other than JavaScript without giving up the browser's security model. More broadly, Wasm solves running untrusted code in isolation at near-native speed — without the overhead of a full virtual machine or a system container.
Components
A compact, fast-to-load bytecode format; it also has an equivalent text format (WAT) for debugging.
A computational model where instructions operate on an implicit operand stack; hardware-independent.
An isolated, contiguous memory region for the module — the foundation of the sandbox and memory safety.
The module's explicit boundary: functions provided by the host (JS/Web APIs or WASI) and exported by the module.
A standardized, capability-based system interface that lets Wasm modules run outside the browser.
An interpreter, JIT or AOT engine that executes modules (e.g. Wasmtime, Wasmer, WasmEdge, wazero).
Implementation
Evolution
Major browser vendors announce joint work on WebAssembly.
The MVP design was finished in March 2017; by November 2017 Wasm was supported in all major browsers.
The WebAssembly Core Specification 1.0 became a W3C Recommendation on 5 December 2019.
WASI 0.2 was released on 25 January 2024, alongside the Component Model.
Hardware requirements
Wasm is a portable, hardware-independent format; the same module runs across different CPU architectures.
Modules are typically compiled (JIT/AOT) to native CPU code, reaching near-native performance.