mdn/webassembly-examples

Code examples that accompany the MDN WebAssembly documentation — see https://developer.mozilla.org/en-US/docs/WebAssembly.

1,211

stars

72

commits

WebAssembly

primary language

Aug 30, 2026

updated

examples
wasm
webassembly
Browse cluster: WebAssembly Compilation & Tooling

README

webassembly-examples

Code examples that accompany the MDN WebAssembly documentation — see https://developer.mozilla.org/en-US/docs/WebAssembly.

Testing/modifying the examples

The examples can be tested locally by running a local server to serve your directory of choice.

If you modify any .wat files for testing you will need to generate a corresponding .wasm file, replacing the existing version in the folder. For most examples, this can be done using the wat2wasm tool, which is part of the WABT: The WebAssembly Binary Toolkit (for setup/usage see Converting the text .wat into a binary .wasm file on MDN and the readme in the WABT GitHub repo.

Note that some examples use features that are still considered optional. These are listed in the supported proposals section on the WABT README.md, along with the flags used to invoke them. For example, to build WASM for the multi-memory example you will need to specify the --enable-multi-memory flag as shown:

wat2wasm --enable-multi-memory multi-memory.wat

Contributors

chrisdavidmills

42 commits

bsmth

5 commits

caugner

5 commits

lukewagner

4 commits

mdn/webassembly-examples

Code examples that accompany the MDN WebAssembly documentation — see https://developer.mozilla.org/en-US/docs/WebAssembly.

1,211

stars

72

commits

WebAssembly

primary language

Aug 30, 2026

updated

examples
wasm
webassembly
Browse cluster: WebAssembly Compilation & Tooling

README

webassembly-examples

Code examples that accompany the MDN WebAssembly documentation — see https://developer.mozilla.org/en-US/docs/WebAssembly.

Testing/modifying the examples

The examples can be tested locally by running a local server to serve your directory of choice.

If you modify any .wat files for testing you will need to generate a corresponding .wasm file, replacing the existing version in the folder. For most examples, this can be done using the wat2wasm tool, which is part of the WABT: The WebAssembly Binary Toolkit (for setup/usage see Converting the text .wat into a binary .wasm file on MDN and the readme in the WABT GitHub repo.

Note that some examples use features that are still considered optional. These are listed in the supported proposals section on the WABT README.md, along with the flags used to invoke them. For example, to build WASM for the multi-memory example you will need to specify the --enable-multi-memory flag as shown:

wat2wasm --enable-multi-memory multi-memory.wat

Contributors

chrisdavidmills

42 commits

bsmth

5 commits

caugner

5 commits

lukewagner

4 commits

Languages

WebAssembly

55.2%

JavaScript

41.1%

HTML

3.2%