TechnologyBinary instruction format

WebAssembly

Also known as: Wasm

Portable binary instruction format that lets code compiled from languages like C, C++ and Rust run safely at near-native speed in web browsers.

WebAssembly, abbreviated Wasm, is a low-level binary format for a stack-based virtual machine, designed as a compilation target for languages such as C, C++, Rust and Go. Code compiled to WebAssembly runs inside the browser alongside JavaScript, in the same security sandbox, but loads and executes much closer to native speed. A human-readable text format exists for inspection and debugging. Every major browser supports it, and it is standardized by the World Wide Web Consortium.

WebAssembly grew from earlier efforts to run fast compiled code on the web, notably Mozilla's asm.js and Google's Native Client. Browser vendors announced a joint design in 2015, shipped a minimum viable product in all major browsers in 2017, and saw the core specification become a W3C Recommendation in December 2019. Later additions include threads, SIMD instructions and garbage collection support, which helps languages such as Kotlin and Dart target it. Toolchains like Emscripten compile existing C and C++ code.

WebAssembly lets complex applications, such as image editors, CAD software, games and scientific tools, run in the browser without plugins. It is also used outside browsers: the WebAssembly System Interface (WASI) defines how modules access files and other resources, enabling lightweight, sandboxed plugins and serverless functions. Its isolation model is a security strength, though compiled code inherits any memory bugs of its source language within its sandbox, and obfuscated modules have been abused for covert cryptocurrency mining.

Key points

  • WebAssembly is a binary compilation target that runs at near-native speed in browsers.
  • It shipped in all major browsers in 2017 and became a W3C Recommendation in 2019.
  • Code runs in the same sandbox as JavaScript, limiting what modules can access.
  • WASI extends WebAssembly to servers, plugins and other environments outside the browser.

Related entries

Technology

JavaScript

Programming

High-level programming language of the web, created at Netscape in 1995, that runs in every major browser and on servers through runtimes like Node.js.

Technology

Rust

ProgrammingFOSS

Systems programming language that guarantees memory safety without a garbage collector through its ownership model, first stable in 2015.

Glossary term

Compiler

Programming

Program that translates source code written in one programming language, usually a high-level one, into another form such as machine code.

Glossary term

Sandboxing

Cybersecurity

Security technique that runs programs in a restricted, isolated environment so that malicious or faulty code cannot harm the rest of the system.

Glossary term

Software implementation of a computer that runs its own operating system or programs in isolation from the physical hardware beneath it.

Organization

World Wide Web Consortium

ProgrammingIdeas and Culture

International standards organization that develops open technical standards and guidelines for the World Wide Web, including CSS and accessibility guidelines.

Technology

C++

ProgrammingVideo Games

General-purpose programming language created by Bjarne Stroustrup as an extension of C, combining low-level control with high-level abstractions.

Glossary term

Technique that compiles code into native machine instructions while a program is running, combining interpreter flexibility with compiled speed.

Referenced by

Other entries that discuss or point to WebAssembly.