What WebAssembly Is and Why It Matters

•6 min read•

For almost the entire history of the web, the browser could run exactly one programming language: JavaScript. If you wanted your code to execute on a web page, you wrote it in JavaScript or you compiled something down to JavaScript and hoped it was fast enough. WebAssembly, usually shortened to Wasm, broke that monopoly. It gives the browser a second thing it can run, a compact and fast format that dozens of languages can target, and it did so without replacing JavaScript or breaking a single existing page.

What it actually is

WebAssembly is a binary instruction format[1]. Instead of shipping human-readable source code, you ship a compiled module of low-level instructions that the browser can validate and execute quickly. It is designed around a simple virtual machine[2], so the same module runs the same way across browsers and operating systems.

It is a compile target, not a language you write by hand[3]. You write Rust, C, C++, or Go, and a compiler produces a .wasm file. There is a text format for reading and debugging, but almost nobody authors it directly.

(module
  (func (export "add") (param $a i32) (param $b i32) (result i32)
    local.get $a
    local.get $b
    i32.add))

That is the human-readable view of a module that adds two integers. In practice your compiler generates the binary equivalent, and you call the exported add function from JavaScript as if it were a normal function.

Why it exists

JavaScript is flexible and has gotten remarkably fast, but it has ceilings. It is dynamically typed, which means the engine spends effort at runtime figuring out what your values are. Performance can also be unpredictable, because the engine optimizes code based on guesses and sometimes has to throw that work away when a guess turns out wrong.

For most web pages this does not matter. For heavy, sustained computation, video editing, 3D rendering, physics, large data processing, it matters a lot. Before Wasm, those workloads either ran slowly in the browser or were pushed off to a server. WebAssembly was created to give the browser a way to run that kind of code at speeds close to a native application.

Where the speed comes from

A Wasm module arrives already compiled to low-level instructions with explicit types, so the browser does far less guesswork. It can validate the module and translate it to machine code quickly, and the performance stays consistent rather than warming up and occasionally stumbling the way heavily optimized JavaScript can. The result is not always faster than the best possible JavaScript, but it is more predictable, which for compute-heavy work is often what you actually want.

Wasm also runs inside the same security sandbox[4] as everything else in the browser. A module cannot reach out and touch your files or memory on its own. It can only do what the page explicitly hands it access to, which is why the browser can run untrusted compiled code from anywhere without the risks that come with native plugins.

The languages that reach it

Rust has become the most popular language for serious WebAssembly work, with mature tooling that makes the whole process straightforward. C and C++ compile to Wasm through the Emscripten toolchain[5], which is how decades of existing native code, including entire media libraries, now run in the browser. Go supports it, and a growing list of other languages do too.

This is the real shift. A team with an existing codebase in a systems language no longer has to rewrite it in JavaScript to put it on the web. They can compile what they already have.

It complements JavaScript, it does not replace it

This is the part people most often get wrong. WebAssembly is not trying to kill JavaScript, and it would be a poor choice for most of what JavaScript does well. Wasm on its own has no direct access to the page, the DOM[6], or browser APIs. To change what is on screen or respond to a click, it talks to JavaScript, which still acts as the glue to the browser.

The healthy pattern is to let each do what it is good at. JavaScript handles the interface, the events, and the orchestration. WebAssembly handles the heavy, numeric, performance-sensitive core. A photo editor might run its filters in Wasm while JavaScript manages the buttons and the layout. The two call back and forth across a small boundary.

What it unlocks in practice

The clearest examples are applications that used to be impossible in a browser. Figma runs its design editor largely in WebAssembly[7], which is a big part of why a browser tab can feel like a desktop application. The ffmpeg media toolkit was compiled to Wasm, so video and audio processing can happen in the browser without uploading files anywhere. Games built in engines like Unity ship to the web through Wasm. Heavy tasks like cryptography, data visualization over large datasets, and parsing all benefit.

Beyond the browser

The idea turned out to be bigger than the web. If WebAssembly is a safe, portable, fast way to run code in a sandbox, there is no reason that sandbox has to be a browser. The WebAssembly System Interface, known as WASI, defines a standard way for Wasm modules to interact with a host system in a controlled manner, which opens the door to running them on servers and at the network edge.

This is where a lot of current energy sits. A Wasm module can start in a fraction of the time a full container takes, runs in a tight sandbox, and is portable across machine architectures. That combination is attractive for serverless and edge computing, where fast startup and strong isolation are exactly the constraints that matter.

Why it matters

WebAssembly ended the browser's single-language era without the disruption such a change usually brings. It lets fast code from almost any language run on the web safely, it gives existing native codebases a path to the browser, and it is quietly becoming a portable runtime well beyond the browser itself. You may never write a line of it directly, but the web keeps getting more capable because it is there.

Sources (7)
  1. Wikipedia: WebAssembly
  2. W3C: WebAssembly Core Specification
  3. MDN Web Docs: WebAssembly concepts
  4. WebAssembly.org: Security
  5. Wikipedia: Emscripten
  6. MDN Web Docs: Using the WebAssembly JavaScript API
  7. Figma Blog: Building a professional design tool on the web