WebAssembly
/ WEB-uh-SEM-blee /
Imagine you want to run the same program quickly on a web page, on a server, and on a tiny edge device near a user - without recompiling it for each one and without trusting it to roam freely on your machine. WebAssembly, almost always shortened to Wasm, is a way to package compiled code in a single portable, low-level format that any compliant runtime can execute safely and fast. You write in C, C++, Rust, or other languages, compile to a .wasm file, and that one file runs anywhere a Wasm runtime exists.
Wasm is a binary instruction format for a simple, abstract stack machine: instead of registers like a real CPU, most instructions push and pop values on an operand stack (for example, i32.const 2, i32.const 3, i32.add leaves 5 on the stack). It is not the source code and not the final machine code - it is a compact bytecode in between, designed to be validated quickly and then compiled to the host's real machine code just before or while it runs. The design fixes a small set of value types (32- and 64-bit integers and floats, plus references), uses structured control flow (blocks, loops, and ifs rather than arbitrary jumps), and is engineered so a runtime can prove a module is well-formed before executing a single instruction.
It matters because it gives near-native speed with a strong sandbox and genuine portability, which is why it spread from browsers to servers, plugin systems, and serverless platforms. Be honest about the edges, though: Wasm is fast but usually a bit slower than fully native code; the core spec by itself has no access to files, the network, or threads - those come from interfaces layered on top (see WASI); and 'portable' means portable across Wasm runtimes, not that any random binary becomes Wasm for free. It is mature in the browser and rapidly maturing, but still moving, outside it.
(func $add (param $a i32) (param $b i32) (result i32) local.get $a local.get $b i32.add) ;; the stack-machine body: push a, push b, i32.add leaves the sum on the operand stack
A tiny Wasm function in its text form (.wat). There are no registers; values flow through an operand stack, and a runtime compiles this to real machine code.
WebAssembly is not assembly for any real CPU and is not tied to the web despite the name; it is a portable bytecode for an abstract stack machine. By itself it cannot touch files, sockets, or the clock - that capability is granted (or withheld) by the host through imports, which is exactly what makes the sandbox meaningful.