What Is WebAssembly? Running Native Code in the Browser
The Browser's Fourth Language
For decades, the browser spoke three languages: HTML for structure, CSS for style, and JavaScript for behavior. JavaScript carried the weight of every interactive feature, every animation, every computation. It did the job, but it was never designed for the workloads we eventually asked of it — 3D rendering, video editing, cryptography, scientific simulation.
WebAssembly is the fourth language. It is a compact binary instruction format that runs in the browser's JavaScript engine, but executes at near-native speed. Unlike JavaScript, it is not handwritten. You compile it from languages like C, C++, Rust, or Go using tools like Emscripten or wasm-pack. What lands in the browser is a .wasm file — small, fast to parse, and executed in a sandboxed memory environment.
How It Actually Works
When a browser loads a WebAssembly module, it goes through a streaming compilation pipeline. The .wasm binary is validated and compiled into machine code while it is still downloading, which means execution can begin almost immediately. The compiled module runs in a linear memory buffer isolated from the host. It has no access to the DOM, network, or filesystem by default. To interact with the page, it calls into JavaScript through an import table, and JavaScript calls into it through exported functions.
This design — fast, sandboxed, predictable — makes WebAssembly useful well beyond the browser. Cloudflare Workers, Shopify Functions, and other serverless platforms run WebAssembly as a lightweight, secure runtime for user-defined logic. The same module can run in the browser and on the edge.
Where It Shines Today
Figma uses WebAssembly to power its rendering engine, cutting load times by a factor of three compared to the previous asm.js implementation. Google Earth runs a native C++ codebase in the browser through WebAssembly. AutoCAD's web version compiles decades of C++ into a .wasm module. Image and video editing tools like Photoshop for the web also lean on it for heavy lifting.
The pattern is consistent: if your application does CPU-bound work — image processing, code compilation, physics simulation, data compression — WebAssembly can make it orders of magnitude faster than equivalent JavaScript.
The Edge Review explains infrastructure concepts for general readers. WebAssembly specifications and browser support evolve quickly; consult MDN or the W3C spec for current details.