# WABT: Command-line tools for manipulating WebAssembly binaries

> WABT is a suite of C/C++ tools for converting between WebAssembly binary and text formats, validating binaries, running them in an interpreter, and converting them to C. It prioritizes spec compliance and integration into toolchains over optimization.

**WebAssembly/wabt** — The WebAssembly Binary Toolkit

- Repository: https://github.com/WebAssembly/wabt
- Stars: 8,146 · Forks: 830
- Language: C++
- License: Apache-2.0
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/webassembly-wabt

## Tools for spec-faithful WebAssembly conversion

WABT is a suite of tools for WebAssembly developed by the WebAssembly community. The acronym is pronounced like "wabbit". The tools are intended for use in toolchains or systems that manipulate WebAssembly files. WABT is written in C/C++ for easier integration into other systems, unlike the WebAssembly spec interpreter which is written to be simple and declarative. Unlike Binaryen, WABT does not aim to provide an optimization platform or a compiler target; instead it aims for full fidelity and compliance with the spec, including 1:1 round-trips with no changes to instructions. The suite includes eleven tools that handle conversion, validation, interpretation, analysis, and code generation. Online demos are available at webassembly.github.io/wabt/demo for those who want to try the tools without building.

## Converting between text and binary formats

WebAssembly has two formats: a binary format and a text format called WAT (WebAssembly text format). The text format looks like S-expressions and is human-readable, useful for debugging and understanding what a module does. The binary format is compact and machine-readable, optimized for download size and parsing speed. The primary tools for conversion are wat2wasm and wasm2wat. wat2wasm translates from WebAssembly text format to the binary format, acting as a compiler for WAT source code. wasm2wat does the inverse: it translates from binary back to text format, also known as a .wat file. This round-trip conversion is lossless, meaning you can convert binary to text and back to binary with no changes. wat-desugar parses .wat text form as supported by the spec interpreter (supporting S-expressions, flat syntax, or mixed styles) and prints canonical flat format, which is useful when you want to normalize WAT output to a standard form.

## Inspecting and running WebAssembly binaries

wasm-objdump prints information about a wasm binary, similar to the Unix objdump tool for native binaries. It shows functions, exports, memory segments, and other metadata. This information helps you understand what a binary contains before running it. wasm-stats outputs statistics for a module such as code size, data segment sizes, function counts, and instruction distribution, useful for profiling and identifying optimization opportunities. wasm-interp decodes and runs a WebAssembly binary file using a stack-based interpreter. This interpreter can execute WASM code without compiling it to native code, which is useful for testing or when you need deterministic execution across platforms. spectest-interp reads a Spectest JSON file (the format used by the WebAssembly specification test suite) and runs its tests in the interpreter, allowing you to validate a WASM implementation against the official test suite. These tools are essential for debugging and understanding module behavior before deploying to production.

## Stripping binaries and translating to C

wasm-strip removes sections of a WebAssembly binary file, reducing file size. This is useful when you have metadata or debugging information that is not needed in production, or when you want to remove the names section to shrink the binary for download. The smaller binary means faster load times for web applications. wasm2c converts a WebAssembly binary file to C source code and a header file. This is a code generation tool: given a .wasm file, it produces .c and .h files that you can compile with a C compiler. This approach is useful when you want to integrate WebAssembly logic into a C project without a runtime, or when you want to debug WebAssembly code in a C debugger using existing debugging tools. The generated C code is portable and can be embedded directly into larger applications. This approach is less common than using native WASM runtimes but useful for projects where a WebAssembly runtime is unavailable or undesirable.

## Validation and test conversion

wasm-validate checks whether a file in the WebAssembly binary format is valid according to the spec. It does not execute the code, only checks that the binary is well-formed and follows all the rules. This is useful for quality assurance and ensuring a binary can be safely distributed. wast2json converts a file in the wasm spec test format to a JSON file and associated wasm binary files. The spec uses a text test format called WAST; this tool converts those tests into JSON and binaries so you can use them with other test runners or tooling. This enables integration with CI/CD systems and custom testing infrastructure.

## Supported WebAssembly proposals

WABT supports multiple WebAssembly proposals, each with a command-line flag to enable or disable it. Exception handling, mutable globals, sign extension, SIMD, multi-value, tail-call, bulk memory, and reference types are enabled by default. Threads and relaxed-simd require the --enable-threads and --enable-relaxed-simd flags respectively. The README contains a detailed table showing which tools support each proposal in binary and text formats, validation, interpretation, and wasm2c code generation. This lets you use WABT with recent or experimental WebAssembly features while keeping compatibility with older code. Features like extended-const, memory64, and multi-memory allow you to work with newer WASM functionality. The proposal table shows exactly which combination of format support each tool offers for each feature, helping you understand what WABT can and cannot do with your code.

## Building and online access

Clone the repository with submodules to fetch the test suite and gtest repos:

```console
$ git clone --recursive https://github.com/WebAssembly/wabt
$ cd wabt
```

Build using CMake:

```console
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
```

WABT can also be compiled to JavaScript via Emscripten, allowing it to run in the browser. Online demos are available at webassembly.github.io/wabt/demo for wat2wasm, wasm2wat, and a general index, allowing you to try the tools in the browser without building locally. The last push was on 2026-09-21, showing active development and ongoing maintenance. The repository builds on Linux, macOS, and Windows.

## When WABT is not the right choice

WABT is not optimized for application development where you do not directly manipulate binaries. If you are writing a WASM application, you use a language like Rust or C that compiles to WASM, not WABT's tools. The compilation happens before you need WABT. WABT also does not provide optimization; if you need to optimize a WASM binary, Binaryen is better suited for that task. WABT is a specialist tool for infrastructure, testing, and toolchain work, not a general-purpose language compiler. The tools are most valuable to people building compilers, test frameworks, or debugging utilities. If you want to work with WASM at the application level, focus on a source language instead of these binary tools.

## Conclusion

WABT suits toolchain and compiler developers who need to manipulate WebAssembly binaries and validate them against the spec. It is most useful when you need guaranteed 1:1 round-trips (text to binary to text with no changes) or when you are building infrastructure that consumes raw WASM. It is less suitable for application developers who do not manipulate binaries directly. Start by cloning the repository with submodules and building with CMake; the online demos at webassembly.github.io/wabt/demo are available if you want to try wat2wasm or wasm2wat without building.

## FAQ

### What is WebAssembly and what is it used for?

WebAssembly is a binary format for code that runs in web browsers and other environments. It compiles from languages like C, C++, and Rust, and runs at near-native speed. Applications include 3D graphics, video encoding, scientific computation, and bringing desktop applications to the web.

### What is the difference between WAT and WASM format?

WAT (WebAssembly text format) is a human-readable S-expression format. WASM is the compact binary format. WABT converts between them: wat2wasm translates text to binary, wasm2wat translates binary back to text.

### How do I validate a WebAssembly binary?

Use wasm-validate: pass a .wasm file as an argument. It checks whether the binary is well-formed and follows all WebAssembly specification rules without executing the code.

### Can WABT optimize WebAssembly code?

No. WABT prioritizes full spec compliance and lossless round-trips. For optimization, use Binaryen, which is explicitly designed as an optimization platform.

## Sources

- [Issues](https://github.com/WebAssembly/wabt/issues)
- [License: Apache-2.0](https://github.com/WebAssembly/wabt/blob/main/LICENSE)
- [README](https://github.com/WebAssembly/wabt/blob/main/README.md)
- [Releases](https://github.com/WebAssembly/wabt/releases)
- [WebAssembly/wabt on GitHub](https://github.com/WebAssembly/wabt)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/webassembly-wabt
