VOOZH about

URL: https://thenewstack.io/webassembly/what-is-webassembly-and-why-do-you-need-it/

⇱ What Is WebAssembly and Why Do You Need It? - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2021-08-02 03:00:59
What Is WebAssembly and Why Do You Need It?
tutorial,
Cloud Native Ecosystem / Software Development / WebAssembly

What Is WebAssembly and Why Do You Need It?

WebAssembly (also known as WASM) was launched in 2017 as a binary instruction format for a stack-based virtual machine, developed to run in modern web browsers.
Aug 2nd, 2021 3:00am by Jack Wallen
👁 Featued image for: What Is WebAssembly and Why Do You Need It?
This post kicks off a series of tutorials to help developers and other curious souls understand the basics of WebAssembly, written by TNS open source correspondent Jack Wallen. Check back often for updates.

WebAssembly (also known as WASM) was launched in 2017 as a binary instruction format for a stack-based virtual machine, developed to run in modern web browsers to provide “efficient execution and compact representation of code on modern processors including in a web browser.

With WebAssembly you can develop high-performance web applications using open web platform technologies and various languages. WebAssembly makes it possible to create video, audio, graphics, 3D environments, multimedia games, cryptographic computations, and even portable language implementations. On top of that, WebAssembly offers serious performance gains over the standard tools. It is not designed to be used as a language itself, but rather as an effective compilation target for languages like C, C++, and Rust (all of which are very fast by design).

WebAssembly is an open standard, created with the following goals in mind:

  • Be executed at near-native speeds.
  • Be readable and easily debuggable.
  • Be secure.
  • Don’t break the web.

But Why WebAssembly?

Traditionally, the web is thought of with two components:

  • A virtual machine
  • A set of Web APIs

For the longest time, JavaScript has been the primary language that runs within the virtual machine, and it has worked quite well for that purpose. However, modern use-cases have illustrated one of the biggest problems with JavaScript — performance. When running resource-intensive apps, such as 3D games, VR and augmented reality, and video editing, we see JavaScript isn’t capable of delivering near-native performance. Couple that with the compute cost of downloading, parsing, and compiling larger JavaScript-based applications, and the issue becomes even more pronounced.

Although WebAssembly is a completely different language than JavaScript, it’s intended to not replace JavaScript, but to run alongside it. This way, developers can get a best-of-both-worlds for their applications. And, unlike JavaScript, WebAssembly is a low-level, assembly-like language with a compact binary format. This makes it possible for WebAssembly to deliver near-native performance.

And with more and more cloud native, mobile-first development going on, near-native performance has become crucial for some applications to function in a way that is viable to consumers.

The main benefits of using WebAssembly are:

  • Near-native performance.
  • Security.
  • Easy debugging.
  • Open-source.
  • Hardware, language, and platform-independent.
  • Lightweight.

There are eight objects that are key to WebAssembly. Those objects are:

  • WebAssembly.Module – this object contains stateless WebAssembly code that has been pre-compiled by the browser.
  • WebAssemly.Global – this object represents a global variable instance that is accessible from both JavaScript and importable/exportable across one or more instances of WebAssembly.Module.
  • WebAssembly.Instance – this object is a stateful, executable instance of WebAssembly.Module.
  • WebAssembly.Memory – this object is a resizable ArrayBuffer or SharedArrayBuffer that holds raw bytes of memory accessed by a WebAssembly.Instance.
  • WebAssembly.Table – this object is a JavaScript wrapper that stores function references.
  • WebAssembly.CompileError – this object indicates an error during decoding or validation.
  • WebAssembly.LinkError – this object indicates an error during a module instantiation.
  • WebAssembly.RuntimeError – this object is an error that is thrown when WebAssembly specifies a trap.

What Should You Know Before Diving into WebAssembly?

Before you embark on developing with WebAssembly, you should at least understand how JavaScript functions within a browser environment. You should also be comfortable working with the command-line interface. C and C++ knowledge would also be a major plus to know.

How Does WebAssembly Work?

In short, there are five steps to creating with WebAssembly:

  1. Install the Emscripten core (an LLVM/Clang-based compiler that compiles C and C++ source into WebAssembly) and the required toolchain.
  2. Create your code in C, C++, or Rust.
  3. Compile your code into WebAssembly with Emscripten.
  4. Convert the compiled WebAssembly code (via glue code) into an HTML page.
  5. Serve your new app via HTTP.

WebAssembly Use Cases

There are so many use-cases for WebAssembly. Some of the possibilities include:

  • Greenfield/multiplatform development.
  • Migrating from desktop-only to desktop and browser-based applications.
  • Modernizing older apps written in Silverlight.
  • Backward compatibility with older platforms.
  • Progressive web apps.
  • Mobile apps.

You’ll also find plenty of websites that were built with WebAssembly. Sites like:

You’ll also find any site that runs a Unity game uses WebAssembly. WebAssembly is also perfectly capable of building web-based apps for word processing, spreadsheets, presentations, slides, photo/video editing, and so much more. And although WebAssembly might not be the most widely-used technology at the moment, it’s gaining ground. As of 2020, the vast majority of WebAssembly was being used for crypto mining and gaming. However, given the nature of how web and mobile applications have evolved, I would expect exponentially more and more WebAssembly to be deployed in the near future.

TRENDING STORIES
Jack Wallen is what happens when a Gen Xer mind-melds with present-day snark. Jack is a seeker of truth and a writer of words with a quantum mechanical pencil and a disjointed beat of sound and soul. Although he resides...
Read more from Jack Wallen
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.