WebAssembly

Hand-drawn three dense blocks of small terracotta cells, each inside a pale hatched margin and a thin terracotta outline, among flowing cream, sand, umber and moss contour lines.

WebAssembly (Wasm) is a portable format for compiled instructions, designed to keep code compact and execute it efficiently. Browsers can run Wasm modules alongside JavaScript, and the WebAssembly System Interface gives programs a way to request services from other hosts. Performance depends on the task and the software running it (Rossberg, 2019; Ehrenberg, 2019; WASI Subgroup, n.d.a; Yan et al., 2021; Jangda et al., 2019). The security model limits what a module can access, while bugs can persist in compiled code (WebAssembly, n.d.b; Lehmann et al., 2020). Studies disagree on how much web Wasm serves cryptomining and obfuscation (Musch et al., 2019; Hilbig et al., 2021).

Modules in a browser

The core specification defines the code format, and the browser interface defines how code on a page interacts with it. The World Wide Web Consortium (W3C) published WebAssembly Core 1.0 as a Recommendation in December 2019. A module is a unit of compiled Wasm code. When JavaScript creates a runnable instance of a module, it supplies the module’s imports, which are values or functions the module needs from outside. JavaScript can then use the module’s exports, such as functions it makes available to the rest of the page (Rossberg, 2019; Ehrenberg, 2019).

A compiler can produce Wasm from several source languages. Emscripten compiles C and C++ to Wasm and can generate JavaScript that provides services to the compiled code. Rust also has a compilation target commonly used for the web and other JavaScript environments (Emscripten, n.d.; The Rust Project, n.d.l).

SIMD, garbage collection and threads

Wasm 2.0 added fixed-width SIMD. Short for single instruction, multiple data, SIMD lets an instruction act on several values at once. Wasm 3.0 added garbage collection, which lets the runtime reclaim memory that the program can no longer reach (WebAssembly, n.d.a).

The threads proposal allows several threads, or paths of execution, to use the same memory. The host creates the threads. Wasm instructions let those threads coordinate their access to shared memory (WebAssembly, 2023).

WASI and the Component Model

The WebAssembly System Interface (WASI) defines services that a host can provide to Wasm programs across environments, including cloud servers and embedded devices. For example, the interfaces for command-line programs include reading and writing files, generating random numbers and checking the time. The host explicitly grants a program access to outside resources (WASI Subgroup, n.d.a; Bytecode Alliance, n.d.c; WASI Subgroup, n.d.b).

The Component Model defines how separately compiled pieces fit together, including pieces written in different languages. A component can package core modules or other components. The interfaces specify the kinds of values each piece accepts or returns. Two pieces can connect when what one exports meets what the other imports (Bytecode Alliance, n.d.a; Bytecode Alliance, n.d.b).

WASI 0.3.0 shipped on June 11, 2026. It uses the Component Model’s built-in support for asynchronous operations, which let work proceed while another operation is pending. In June 2026 the Bytecode Alliance still described a stable, formally specified Component Model 1.0 as a future milestone. The W3C working group’s August 2026 charter makes its work on a formal specification conditional on the proposal reaching Phase 4 of its standards process (WASI Subgroup, n.d.c; Gregory, 2026; World Wide Web Consortium, 2026h).

Speed compared with JavaScript and native code

Wasm’s speed relative to JavaScript varies with the program and the execution environment. In 2018 the Wasm version of the Ostrich numerical tests outperformed the JavaScript version overall on the tested browsers and devices. The Wasm and JavaScript versions of Hyphenopoly.js took similar time to find where to hyphenate words in the tested English and French texts. That study appeared in 2021 and used browser releases from around December 2019 (Herrera et al., 2018; Yan et al., 2021).

Two implementations can also divide the same work differently. In the 2021 study’s FFmpeg media conversion test, the Wasm version split conversion among several workers. The tested JavaScript version ran the conversion serially (Yan et al., 2021).

Against native code, which is compiled for the device’s processor, the size of the slowdown depends on what the benchmark runs. Seven PolyBenchC tests in the 2017 design paper ran within 10% of native performance. In a 2019 SPEC CPU benchmark study, Wasm took 1.55 times as long as native in Chrome 74 and 1.45 times as long in Firefox 66. Those figures are geometric means, which summarise the ratios of Wasm to native execution time across programs (Haas et al., 2017; Jangda et al., 2019).

A speed score also depends on which runs it counts. JetStream 3 uses the same scoring method for JavaScript and Wasm. It measures the first run, the slowest runs and the average of subsequent runs (Miller, 2026).

How often websites load Wasm

The HTTP Archive detected Wasm on a small share of the sites it crawled. The 2025 Web Almanac identified Wasm using the response’s declared content type and the .wasm file extension. This counts visible requests for Wasm files. An execution-based measurement can also see modules embedded directly in JavaScript when they run (VN et al., 2025; Hilbig et al., 2021).

HTTP Archive crawlDesktopMobile
September 1, 20210.06% of domains0.04% of domains (Stepanyan et al., 2021)
July 20250.35% of sites0.28% of sites (VN et al., 2025)

Security and misuse

Wasm’s security model runs each module in a sandbox, an environment isolated from the host runtime. The module reaches resources outside the sandbox through interfaces the host authorises. Within the module, source code bugs involving incorrect memory access can survive compilation (WebAssembly, n.d.b; Lehmann et al., 2020).

The runtime, the software that executes Wasm, can also have defects. One study tested seven runtimes and reported 60 previously unreported bugs. By publication, developers had confirmed 13 and fixed 9 (Zhang et al., 2023a).

Cryptomining and obfuscation on the web

Studies disagree on how much web Wasm serves cryptomining, which performs computations for a cryptocurrency, and obfuscation, which makes code harder to inspect. A 2019 study of the Alexa Top 1 million reported activity it classified as malicious on over half of the sampled sites where Wasm ran. That category included mining and obfuscation (Musch et al., 2019; Hilbig et al., 2021).

A separate study collected binaries, or compiled files, from April to September 2020. It associated less than 1% of the collected web binaries with mining and warned that its analysis could miss miners. The earlier study counted sites and included several kinds of activity. The later figure measures the share of collected files linked to mining alone. The two estimates leave the change in malicious use over time unresolved (Musch et al., 2019; Hilbig et al., 2021).

In that April–September 2020 sample, the researchers found 28.8% of web binaries minified (Hilbig et al., 2021).

Further reading

Known gaps

What this article cannot tell you yet.

  1. Browser support for individual WebAssembly features was outside the scope of the specification comparison.
  2. The browser speed comparisons use historical browser releases. The article has no equivalent comparison across current releases.
  3. The web measurements give snapshots of detected use. They leave adoption in standalone runtimes unmeasured.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 26 references