Paradigm Imperative, structured, expression-oriented
Developer W3C
First appeared March 2017 (2017-03)
Typing discipline Static
OS Web
License Apache 2.0 License
Filename extensions .wat, .wasm
Website webassembly.org
Influenced by
asm.js, PNaCl

WebAssembly (Wasm, WA) is a web standard that defines a binary format and a corresponding assembly-like text format for executable code in Web pages. It is meant to enable executing code nearly as fast as running native machine code. It was envisioned to complement JavaScript to speed up performance-critical parts of web applications and later on to enable web development in languages other than JavaScript.[1][2][3] WebAssembly does not attempt to replace JavaScript, but to complement it.[4] It is developed at the World Wide Web Consortium (W3C) with engineers from Mozilla, Microsoft, Google and Apple.[5]

It is executed in a sandbox in the web browser after a verification step. Programs can be compiled from high-level languages into Wasm modules and loaded as libraries from within JavaScript applets.


WebAssembly code is intended to be run on a portable abstract structured stack machine,[6] which is designed to be faster to parse than JavaScript, as well as faster to execute,[7] and to enable very compact code representation.


Vendor-specific precursor technologies are Google Native Client (NaCl) and asm.js.[1][8] The initial implementation of WebAssembly support in browsers was based on the feature set of asm.js.[9] It was first announced on 17 June 2015[10] and on 15 March 2016 was demonstrated executing Unity's Angry Bots in Firefox,[11] Chromium, Google Chrome,[12] and Microsoft Edge.[13] In March 2017, the design of the minimum viable product was declared to be finished and the preview phase ended.[14] In late September 2017, Safari 11 was released with support. As of August 2018, the website Can I use tracks 75.32% global web browser support for WebAssembly (and indirectly, through polyfill, others are supported).[15] In February 2018 the WebAssembly Working Group published three public working drafts for the Core Specification, JavaScript Interface, and Web API.[16][17][18][19]


In November 2017, Mozilla declared support "in all major browsers",[20] after WebAssembly was enabled by default in Edge 16.[21] For backward compatibility, Wasm can be compiled into asm.js by a JavaScript applet (a so-called polyfill) and executed on incompatible browsers this way.[22]

Emscripten can compile to Wasm[14] using LLVM in the backend.

Its initial aim is to support compilation from C and C++,[7] though support for other source languages such as Rust and .NET languages is also emerging.[23][24] After the minimum viable product (MVP) release, there are plans to support garbage collection[25] which would make WebAssembly a compilation target for garbage collected programming languages like Java, C# and Go.


In March 2017, the WebAssembly Community Group reached consensus on the initial (MVP) binary format, JavaScript API, and reference interpreter.[26] It defines a WebAssembly binary format, which is not designed to be used by humans, as well as a human-readable linear assembly bytecode format that resembles traditional assembly languages.

The table below represents three different views of the same source code input from the left, as it is converted to a Wasm intermediate representation, then to Wasm binary:[27]

C input sourceLinear assembly bytecode
(intermediate representation)
Wasm binary encoding
(hexadecimal bytes)
int factorial(int n) {
  if (n == 0)
    return 1;
    return n * factorial(n-1);
get_local 0
if (result i64)
    i64.const 1
    get_local 0
    get_local 0
    i64.const 1
    call 0
20 00
04 7E
42 01
20 00
20 00
42 01
10 00

The WebAssembly text format can also be written in a folded format using s-expressions. This format is purely syntactic sugar and has no behavioral differences with the linear format.[28] An example is shown below:

  (import "math" "exp" (func $exp (param f64) (result f64)))
  (func (export "doubleExp") (param $0 f64) (result f64)
      (call $exp
        (get_local $0))
      (f64.const 2))))

See also



  1. 1 2 Lardinois, Frederic (2015-06-17). "Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web". TechCrunch. Retrieved 2017-12-24.
  2. Cimpanu, Catalin (2015-06-18). "Mozilla, Microsoft, Google, and Apple Join Efforts to Create a Binary File Format for the Web". softpedia. Retrieved 2017-12-23.
  3. Hoffmann, Moritz (2015-06-23). "Turbo-Boost für JavaScript: Eric Elliott über WebAssembly". JAXenter (in German). Retrieved 2017-12-23.
  4. "Is WebAssembly trying to replace JavaScript?".
  5. Bright, Peter (18 June 2015). "The Web is getting its bytecode: WebAssembly". Ars Technica. Condé Nast.
  6. "Design Rationale". GitHub / WebAssembly / design. 1 October 2016.
  7. 1 2 "WebAssembly High-Level Goals". GitHub / WebAssembly / design. 11 December 2015.
  8. Avram, Abel (2017-05-31). "Google Is to Remove Support for PNaCl". InfoQ. Retrieved 2017-12-22.
  9. "WebAssembly: a binary format for the web". ②ality – JavaScript and more. 18 June 2015.
  10. "Launch bug". GitHub / WebAssembly / design. 11 June 2015.
  11. Wagner, Luke (14 March 2016). "A WebAssembly Milestone: Experimental Support in Multiple Browsers". Mozilla Hacks.
  12. Thompson, Seth (15 March 2016). "Experimental support for WebAssembly in V8". V8 Blog.
  13. Zhu, Limin (15 March 2016). "Previewing WebAssembly experiments in Microsoft Edge". Microsoft Edge dev blog.
  14. 1 2 Krill, Paul (2017-03-06). "WebAssembly is now ready for browsers to use". InfoWorld. Retrieved 2017-12-23.
  15. "WebAssembly". Can I use. Retrieved 2018-03-07.
  16. "WebAssembly First Public Working Drafts". W3C. February 15, 2018. Retrieved April 20, 2018.
  17. "WebAssembly Core Specification". W3C. February 15, 2018. Retrieved April 20, 2018.
  18. "WebAssembly JavaScript Interface". W3C. February 15, 2018. Retrieved April 20, 2018.
  19. "WebAssembly Web API". W3C. February 15, 2018. Retrieved April 20, 2018.
  20. "WebAssembly support now shipping in all major browsers". The Mozilla Blog. Retrieved 2017-11-21.
  21. "Introducing new JavaScript optimizations, WebAssembly, SharedArrayBuffer, and Atomics in EdgeHTML 16". Microsoft Edge Dev Blog. Retrieved 2017-11-21.
  22. Bright, Peter (2015-06-18). "The Web is getting its bytecode: WebAssembly". Ars Technica. Retrieved 2017-12-23.
  23. Krill, Paul (2017-11-29). "Direct WebAssembly compilation comes to Rust language". InfoWorld. Retrieved 2017-12-24.
  24. "Frequently asked questions (FAQ) about Blazor". blazor.net. Retrieved 2018-06-18.
  25. Krill, Paul (2017-10-26). "What's next for WebAssembly: GC, threads, debugging". TechWorld. Retrieved 2017-12-24.
  26. "Roadmap". WebAssembly. March 2017.
  27. jfbastien; rossberg-chromium; kripken; titzer; s3ththompson; sunfishcode; lukewagner; flagxor; enricobacis; c3d; binji; andrewosh (9 March 2017). "Text Format". WebAssembly/design. GitHub.
  28. "Folded instructions". GitHub. / WebAssembly / spec

 This article incorporates text from a free content work. Licensed under Apache License 2.0 License statement: Text Format, jfbastien; rossberg-chromium; kripken; titzer; s3ththompson; sunfishcode; lukewagner; flagxor; enricobacis; c3d; binji; andrewosh, GitHub. WebAssembly/design. To learn how to add open license text to Wikipedia articles, please see Wikipedia:Adding open license text to Wikipedia. For information on reusing text from Wikipedia, please see the terms of use.

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.