Our volunteers haven't translated this article into عربي yet. Join us and help get the job done!
You can also read the article in English (US).

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The WebAssembly JavaScript object acts as the namespace for all WebAssembly-related functionality.

Unlike most other global objects, WebAssembly is not a constructor (it is not a function object). You can compare it to Math, which is also a namespace object for mathematical constants and functions, or to Intl which is the namespace object for internationalization constructors and other language sensitive functions.


The primary uses for the WebAssembly object are:


The primary API for compiling and instantiating WebAssembly code, returning both a Module and its first Instance.
Compiles a WebAssembly.Module from WebAssembly binary code, leaving instantiation as a separate step.
Validates a given typed array of WebAssembly binary code, returning whether the bytes are valid WebAssembly code (true) or not (false).


Creates a new WebAssembly Module object.
Creates a new WebAssembly Instance object.
Creates a new WebAssembly Memory object.
Creates a new WebAssembly Table object.
Creates a new WebAssembly CompileError object.
Creates a new WebAssembly LinkError object.
Creates a new WebAssembly RuntimeError object.


After fetching some WebAssembly bytecode using fetch, we compile and instantiate the module using the WebAssembly.instantiate() function, importing a JavaScript function into the WebAssembly Module in the process. This promise resolves to an object (result) containing the compiled Module and Instance objects. We then call an Exported WebAssembly function that is exported by the Instance.

var importObject = {
  imports: {
    imported_func: function(arg) {

fetch('simple.wasm').then(response =>
).then(bytes =>
  WebAssembly.instantiate(bytes, importObject)
).then(result =>

Note: See index.html on GitHub (view it live also) for an example that makes use of our fetchAndInstantiate() library function.


Specification Status Comment
Web Assembly JavaScript API
The definition of 'WebAssembly' in that specification.
Draft Initial draft definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic Support5716522 No4411
CompileError5716522 No4411
Instance5716522 No4411
LinkError5716522 No4411
Memory5716522 No4411
Module5716522 No4411
RuntimeError5716522 No4411
Table5716522 No4411
compile5716522 No4411
instantiate5716522 No4411
validate5716522 No4411
FeatureAndroidChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic Support5757 (Yes)1522 No ?11
CompileError5757 (Yes)1522 No ?11
Instance5757 (Yes)1522 No ?11
LinkError5757 (Yes)1522 No ?11
Memory5757 (Yes)1522 No ?11
Module5757 (Yes)1522 No ?11
RuntimeError5757 (Yes)1522 No ?11
Table5757 (Yes)1522 No ?11
compile5757 (Yes)1522 No ?11
instantiate5757 (Yes)1522 No ?11
validate5757 (Yes)1522 No ?11

1. This feature is behind the Experimental JavaScript Features preference.

2. Disabled in the Firefox 52 Extended Support Release (ESR).

See also

Document Tags and Contributors

 Contributors to this page: fscholz, chrisdavidmills, emilbayes, apurv-pandey, lukewagner
 Last updated by: fscholz,