Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.
* Some parts of this feature may have varying levels of support.
The WebAssembly.validate() static method validates a given typed array of WebAssembly binary code, returning whether the bytes form a valid Wasm module (true) or not (false).
A typed array or ArrayBuffer containing WebAssembly binary code to be validated.
compileOptions OptionalAn object containing compilation options. This parameter is included on the validate() method so that it can be used to validate modules when the compilation options are present (for example, to implement feature detection). Properties can include:
builtins OptionalAn array of strings that enables the usage of JavaScript builtins in the compiled Wasm module. The strings define the builtins you want to enable. Currently the only available value is "js-string", which enables JavaScript string builtins.
importedStringConstants OptionalA string specifying a namespace for imported global string constants. This property needs to be specified if you wish to use imported global string constants in the Wasm module.
A boolean that specifies whether bufferSource is valid Wasm code (true) or not (false).
If bufferSource is not a typed array or ArrayBuffer, a TypeError is thrown.
The following example (see the validate.html source code, and see it live too) fetches a Wasm module and converts it into a typed array. The validate() method is then used to check whether the module is valid.
This example validates a Wasm module with JavaScript string builtins and imported global string constants enabled, logging "Wasm module valid: true" to the console if it is valid, and "Wasm module valid: false" if it isn't. See it running live.
| WebAssembly JavaScript Interface # dom-webassembly-validate |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 22, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.