Skip to content

Note webassembly

All posts
Oct 28, 20267 min readwebassembly · wasm · web development · performance · javascriptRead in:ENID

WebAssembly Explained: How Near-Native Speed Runs in Your Browser

WebAssembly is a portable binary format that lets code written in C, C++, Rust, and other languages run in the browser at near-native speed, alongside JavaScript. From Figma to Photoshop on the web, it powers the apps that feel too fast for a browser tab.

Colorful programming code on a dark computer monitor.

Some of the most demanding software you use every day now runs inside a browser tab: a full design tool, a photo editor, a 3D globe, a video editor. None of that was practical when JavaScript was the only language the browser could run fast. WebAssembly, usually shortened to Wasm, is the technology that changed that. It gives the browser a second, much faster way to run code, without replacing JavaScript.

Key Takeaways

WebAssembly is a portable binary format, not a programming language you write by hand. You compile code written in languages like C, C++, Rust, or Go into Wasm, and the browser runs it.

Wasm runs alongside JavaScript, not instead of it. JavaScript still handles the page, the DOM, and web APIs, while Wasm takes the heavy computation.

It became a W3C Recommendation in December 2019, and all major browsers have supported it since 2017.

The same technology now runs outside the browser too, on servers and edge platforms, through the WebAssembly System Interface (WASI).

Reach for Wasm when a task is compute heavy, such as image processing, games, or video encoding. For ordinary page logic, plain JavaScript is still the simpler choice.

What Is WebAssembly?

WebAssembly is a low-level, assembly-like binary format that browsers can execute at near-native speed. The key word is "target": developers rarely write Wasm directly. Instead, they write code in a language such as C, C++, Rust, or Go, and a compiler turns that code into a compact `.wasm` module. The browser downloads the module, validates it, and runs it in a sandboxed environment.

MDN describes WebAssembly as a low-level bytecode format originally designed for the web, built as an effective compilation target for languages like C, C++, and Rust, and notes that it provides a way to run code written in multiple languages on the web at near-native speed.

That sandbox matters. Wasm code cannot touch the network, the file system, or the page directly. It can only do those things through JavaScript and the web APIs JavaScript already has access to, and it follows the same security rules, including the same-origin policy. The result is code that is fast, but still fenced in like any other web code.

A Short History: From 2015 Announcement to Web Standard

WebAssembly was first announced in 2015, and the minimum viable product was declared finished in March 2017, with all four major browser engines shipping support that year. Its predecessors were Mozilla's asm.js and Google's Native Client, and the initial design was based on the asm.js feature set.

On 5 December 2019, WebAssembly became a W3C Recommendation, putting it alongside HTML, CSS, and JavaScript as a core web technology. Wikipedia records the announcement in 2015, the first release in March 2017, and the W3C Recommendation on 5 December 2019.

Development did not stop there. WebAssembly 2.0, finished in draft form in 2022, added vector (SIMD) instructions, bulk memory operations, multiple return values, and simple reference types. Then, on 17 September 2025, webassembly.org announced Wasm 3.0 as the new live standard, bringing garbage collection, exception handling, tail calls, and 64-bit memories. The 64-bit address space is especially important outside the browser: on the web it is limited to 16 gigabytes, but non-web runtimes can now support much larger data sets.

How WebAssembly Works With JavaScript

Think of the browser as having two engines that cooperate. JavaScript handles interactivity, the DOM, and web APIs. Wasm handles the heavy lifting. A typical flow looks like this:

  1. JavaScript fetches a `.wasm` module, often with streaming compilation so execution can start while the rest of the file is still downloading.

  2. The browser validates the module, checking that its types and memory use are safe, before running a single instruction.

  3. JavaScript calls exported Wasm functions, passing numbers or shared memory back and forth.

  4. Wasm returns results, and JavaScript updates the page with them.

This division of labor is the whole point. You do not rewrite an app in Wasm. You keep the JavaScript you already have, and you move only the hot path, the loop that runs millions of times, into a compiled language.

WebAssembly vs JavaScript: When Each One Wins

Aspect

JavaScript

WebAssembly

What it is for

Page logic, UI, web APIs

Heavy computation

Written in

JavaScript or TypeScript

C, C++, Rust, Go, C#, and more

Speed on compute heavy work

Good, and improving every year

Near native, often much faster

Access to the DOM

Direct

Only through JavaScript

Startup cost

Parse and compile

Download, validate, compile

Best for

Most web apps

Games, editors, codecs, simulations

The table also explains when not to use Wasm. If your app is mostly buttons, forms, and API calls, Wasm adds build complexity for no visible gain. The win appears when the same calculation runs over and over: applying a filter to every pixel of a photo, simulating physics, encoding video, or running a game loop.

Where You Already Use WebAssembly

You have probably used Wasm without knowing it. The Web Almanac 2022 chapter on WebAssembly names Google Earth, where the C++ desktop application became available in the browser, Figma, which saw significant performance improvements from the technology, and Photoshop on the web, which uses it for similar reasons. Game engines such as Unity and Unreal export to WebAssembly too, which is how full 3D games run in a tab with no plugin and no install.

Other everyday examples include in-browser video tools built on FFmpeg compiled to Wasm, which transcode video entirely on your device, and machine learning inference that runs locally in the browser instead of on a server. If a web app feels surprisingly powerful for something running in a tab, Wasm is a likely suspect.

Beyond the Browser: WASI and the Component Model

WebAssembly was designed for the web, but it makes no web-specific assumptions, so it escaped the browser early. The missing piece was a way for Wasm modules to talk to the outside world, since a browser module has no file system or network of its own. That piece is WASI, the WebAssembly System Interface: a standard, capability-based interface that gives modules controlled access to files, clocks, random numbers, and, in newer versions, networking and richer interfaces between components.

With WASI, the same sandboxed, portable module can run on a server, at the edge, or on a small device, using runtimes such as Wasmtime or Wasmer. Cloudflare Workers and Fastly Compute run Wasm at the edge, where its tiny size and fast startup are a natural fit. The Component Model goes further, letting modules written in different languages compose into one application with typed interfaces, like plug-ins that can be mixed and matched safely.

This is the same portability idea behind containers, but at a smaller grain: Docker Explained: What Containers Are and Why Developers Love Them covers the container side of that story, while Wasm offers a lighter, language-neutral unit of deployment.

How to Try WebAssembly Yourself

You do not need to learn a new language to experiment. The fastest path:

  1. Pick a language with good Wasm tooling. Rust, with `wasm-pack` and `wasm-bindgen`, is the most beginner-friendly route today. C and C++ developers typically use Emscripten.

  2. Write a small, compute-heavy function, for example an image filter or a sorting routine.

  3. Compile it to a `.wasm` module and load it from a tiny JavaScript page with `WebAssembly.instantiateStreaming`.

  4. Measure before and after. If the Wasm version is not clearly faster, the task probably did not need it, and that is a useful result too.

For debugging, browsers now include Wasm-aware developer tools, and the human-readable text format, called WAT, lets you inspect a module when something looks wrong. The ecosystem is mature enough that the hard part is no longer the tooling, it is choosing the right workload.

Frequently Asked Questions

Is WebAssembly going to replace JavaScript?

No. WebAssembly cannot access the DOM or web APIs directly, and it was designed to complement JavaScript, not replace it. JavaScript remains the language of the web page, while Wasm handles the computation JavaScript is slow at.

Do I need to learn WebAssembly itself?

Almost certainly not. Most developers write in Rust, C++, Go, or another language and compile to Wasm. Knowing how modules load and how memory is shared with JavaScript is enough for most projects.

Is WebAssembly supported in all browsers?

Yes, in practice. All major browsers have shipped WebAssembly support since 2017, and the core features are stable across Chrome, Firefox, Safari, and Edge. Newer features such as threads or garbage collection roll out gradually, so check support for the specific feature you need.

Is WebAssembly only for the browser?

No. Through WASI and standalone runtimes, Wasm modules run on servers, at the edge, and on embedded devices. The browser is where it started, not where it ends.

The Bottom Line

WebAssembly quietly became one of the web's core technologies: announced in 2015, shipped in every major browser in 2017, standardized by the W3C in 2019, and extended to a full 3.0 standard in 2025. It does not change what the web is for, it changes what the web can handle. Desktop-class editors, games, and media tools now run in a tab because the browser gained a fast, safe, portable way to run compiled code, right next to JavaScript.

If you build something compute heavy for the web, Wasm is worth a serious look. If you build ordinary web apps, you will still benefit from it every time you open Figma, edit a photo, or play a game in your browser, without ever writing a line of it.

Read this article in Indonesian: WebAssembly Dijelaskan: Cara Kecepatan Hampir Natif Berjalan di Browser Anda

Tags: webassembly · wasm · web development · performance · javascript

All posts