What Is WebAssembly?

Learn the basics of WebAssembly.

WebAssembly is a binary instruction format that allows code written in C# to run on the browser at near-native speed. To run .NET binaries in a web browser, it uses a version of the .NET runtime that has been compiled to WebAssembly. We can think of it as executing natively compiled code in a browser.

WebAssembly is an open standard developed by a W3C Community Group. It was originally announced in 2015, and the first browser that supported it was released in 2017.

WebAssembly goals

When WebAssembly was originally being developed, there were four main design goals for the project:

  • Fast and efficient
  • Safe
  • Open
  • Don’t break the web

WebAssembly is fast and efficient. It is designed to allow developers to write code in any language that can then be compiled to run in the browser. Since the code is compiled, it is fast and performs at near-native speed.

WebAssembly is safe. It does not allow direct interaction with the browser’s DOM. Instead, it runs in its own memory-safe, sandboxed execution environment. We must use JavaScript interop to interact with the DOM. Later, we’ll learn how to use JavaScript interop when building local storage services.

WebAssembly is open. Although it is a low-level assembly language, it can be edited and debugged by hand.

WebAssembly didn’t break the web. It is a web standard that is designed to work with other web technologies. Also, WebAssembly modules can access the same Web APIs that are accessible from JavaScript.

WebAssembly support

As mentioned earlier, WebAssembly runs on all modern browsers, including mobile browsers. As we can see from the following table, all current versions of the most popular browsers are compatible with WebAssembly:

Get hands-on with 1400+ tech skills courses.