Advanced Tools

WebAssembly is supported by a number of tools to help developers build and process source files and generated binary content. If you’re a compiler writer, enjoy low level coding or just want to experiment with the raw WebAssembly format, these tools are for you.

There are currently two distinct sets of tools that are of interest to compiler writers or developers who want to work with WebAssembly binary generated by other tools like Emscripten:

  • WABT - The WebAssembly Binary Toolkit
  • Binaryen - Compiler and toolchain infrastructure

WABT: The WebAssembly Binary Toolkit

This toolkit supports conversion between the binary WebAssembly format into and out of a human readable text format. The text format is a type of S-expression that makes it convenient to work with the output of a WebAssembly compiler for analysis or debugging purposes, etc.

Note, that the S-expression format supported by WABT is not WebAssembly itself. It’s one of many possible text formats that could represent the content of a WebAssembly file, so it’s been developed as a convenient format for the purposes of decode and encode by WABT tools. Developers could easily build decoder/encoder implementations for any other textual format capable of expressing the WebAssembly stack machine semantics.

wasm2wast tool

This tool converts WebAssembly binary into S-expressions. It is a command line tool that takes a binary file as input and generates an output file containing the readable text.

Developers could edit or manipulate the text file in some other way and convert it back into the binary format for things like trying out optimization algorithms, tracing, inserting debugging hooks, etc.

wast2wasm tool

This command line tool performs the inverse of wasm2wast, i.e. it converts the S-expression WAST file into a binary WebAssembly file.

Using wasm2wast and wast2wasm together allows lossless round tripping of WebAssembly binaries, and provides developers with a convenient way to manipulate the content of WebAssembly binaries using external tools.

wasm-interp tool

This is an interpreter that lets developers run a WebAssembly binary from the command line stand-alone. It implements a stack-machine based interpreter that interprets the WebAssembly binary directly. This differs from how a browser would JIT the WebAssembly binary into native code for its target architecture at load time.

The interpreter can be useful for running unit tests, validating WebAssembly binary files, etc. outside of a browser environment.


Binaryen is a comprehensive set of tools with supporting infrastructure for use as the backend of compilers that are targeting WebAssembly as an output format. It has a C API and implements its own internal intermediate representation (IR) of program logic and can perform a number of optimizations on the IR, support parallelization of code generation, etc.

For example, binaryen is used as part of the compiler asm2wasm that can convert asm.js files into WebAssembly files. It’s also used for supporting the LLVM compiler infrastructure generation of WebAssembly and compilation from Rust.

Developers working on compilers, advanced optimization techniques and so forth should take advantage of binaryen and its tools that include a shell that can load and interpret WebAssembly code, assembler and disassembler, converters for asm.js and LLVM .s files into WebAssembly and so on.

Tool developers are highly encouraged to explore the full set of functionality implemented by binaryen.