Chris Collins

Tools · dev

WebAssembly explorer

Write WebAssembly text and run it in the page, inspect any .wasm file — sections, functions, sizes, imports, exports, data, an annotated hex dump and a full disassembly — and learn how the format works.

Added

How to use it
  • WAT playground — pick an example (the Mandelbrot one draws on a canvas) or write your own module in the text format. Assemble & run (or Cmd/Ctrl + Enter) assembles it with wabt and instantiates it; every exported function gets a form to call it with typed arguments (i64 values go in as BigInt), and you see the result and how long the call took. Imports are supplied automatically: functions named like log print their arguments, log_str(pointer, length) prints a string from memory, and canvas(pointer, width, height) draws RGBA pixels from memory. Errors show the line and column; click one to jump to it. The Hex, Text and Memory views show the binary you just made, decoded back to text, and the live memory as bytes, integers or floats.

  • Inspector — drop any .wasm (from Emscripten, Rust, Go, Zig, AssemblyScript…), fetch one by URL, or open the playground’s module. Overview lists the sections and what takes the space (largest functions, data); Functions is a sortable list — click one for its disassembly, optionally with offsets and bytes; Text prints the whole module as WAT, optionally side by side with wabt’s wasm2wat; Hex is an annotated dump where every byte is explained and hovering links the bytes and their meaning; Custom sections decodes names, producers and target features. The page also asks your browser whether it would compile the module, and why not.

  • How it works — the module structure, the stack machine, value types, a LEB128 encoder/decoder, linear memory, tables, imports and exports, the JavaScript API, WASI, size and speed tips, and a live check of which WebAssembly features your browser supports.

  • Opcodes — every instruction with its encoding and immediates, searchable.

  • ⛶ Full screen (or F when you are not typing) gives the playground’s editor and results the whole screen, side by side (stacked on a phone), or on the Inspector’s Hex view the bytes and their annotations (◫ Panels shows the module picker and summary) — the browser’s full screen where it is allowed, otherwise a full-window layer (iPhone). Escape leaves.

The inspector’s parser and disassembler are written from the WebAssembly specification (2.0, plus tail calls, exceptions, GC, memory64, multi-memory, threads and relaxed SIMD) and run entirely in your browser. They are checked against wabt: every opcode wabt can assemble decodes to the same instruction, and the disassembly re-assembles to identical bytes. A component-model binary (WASI 0.2) is recognised but not taken apart.

Network use: the examples are pre-assembled, so they run straight away. Editing loads the wabt assembler (wabt.js 1.0.39, about 200 KB compressed) from jsDelivr once; Fetch loads the URL you give it. Nothing you write or open is uploaded anywhere. Fetching a URL only works if that server allows cross-origin requests (CORS); otherwise download the file and drop it in.

Sharing

Share link copies a URL that opens the playground as you have it. An unedited example gives a short link you can also write by hand — ?ex= takes mandelbrot, add, factorial, fibonacci, hello, table or simd, for example /tools/wasm/?ex=simd. Edited source and any assembler features you changed are packed into the link instead. Shared code is shown, not run: press Assemble & run when you have read it. Sharing from the Inspector tab also includes the URL in its fetch box (?url=…#inspect), which is filled in but not fetched until you press Fetch.

Runs entirely in your browser — network requests go only to the services named on this page.