Which Programming Languages and Environments Can Use WebAssembly?

Updated

WebAssembly (Wasm) is a portable compilation target for programming languages, so any language with a toolchain that emits Wasm can use it. On the environment side, Wasm runs in web browsers for client-side applications, on servers, and in non-web embeddings. It also interoperates with JavaScript: modules can call into and out of the JavaScript context and access the same browser Web APIs available to JavaScript.

Languages: What "Compilation Target" Means

Wasm is not a language you typically write by hand for production code. It is a binary instruction format for a stack-based virtual machine, designed to be produced by compilers. That means the practical question is not "does Wasm support language X?" but "does language X have a compiler or toolchain that can emit Wasm?"

A language can target Wasm if its toolchain can compile to the Wasm binary format. The site describes Wasm as a portable compilation target for programming languages generally, rather than listing specific languages. So the reliable way to decide is to check whether the toolchain for your language of choice supports a Wasm output target. If it does, your code can be compiled to a Wasm module and run wherever Wasm is supported.

The Text Format Is for Reading, Not Usually for Writing

Wasm is designed to be pretty-printed in a textual format for debugging, testing, experimenting, optimizing, learning, teaching, and writing programs by hand. That textual format is also what you see when viewing the source of Wasm modules on the web. In practice, most developers compile from a higher-level language and use the text format to inspect or debug the output.

Environments: Web, Server, and Beyond

Wasm is not limited to the browser. The site states it enables deployment on the web for client and server applications and also supports non-web embeddings. The table below summarizes the environment categories the site describes.

Environment What the site says Practical implication
Web browser (client) Enables deployment on the web for client applications; enforces the browser's same-origin and permissions security policies Wasm modules can run in web pages alongside JavaScript
Server Enables deployment on the web for server applications Wasm is not browser-only; server-side use is in scope
Non-web embeddings Wasm supports non-web embeddings Hosts other than browsers can embed and run Wasm
JavaScript context Modules can call into and out of the JavaScript context and access browser functionality through the same Web APIs accessible from JavaScript Wasm and JavaScript can interoperate in both directions

How Wasm Interoperates with JavaScript and the Browser

When embedded in the web, Wasm runs in a memory-safe, sandboxed execution environment and enforces the same-origin and permissions security policies of the browser. It can be implemented even inside existing JavaScript virtual machines. For developers, the key interoperability points are:

  • Calling in and out of JavaScript: Wasm modules can call JavaScript functions, and JavaScript can call into Wasm modules.
  • Access to Web APIs: Wasm can reach browser functionality through the same Web APIs that JavaScript uses.
  • Sandboxing: Execution is memory-safe and sandboxed, with browser security policies applied when on the web.

Why This Matters for Choosing a Language or Environment

Wasm is designed to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms, and its binary format is designed to be size- and load-time-efficient. It also maintains the versionless, feature-tested, and backwards-compatible nature of the web. For a developer, this means:

  • If your language's toolchain can emit Wasm, you can reuse that language for web client, server, or non-web embedding targets.
  • If you need to interact with browser APIs or existing JavaScript code, Wasm modules can do so through the JavaScript context.
  • If you are targeting a non-browser host, check that the host supports a non-web embedding of Wasm.

Where to Verify Specifics

The site points to MDN's WebAssembly pages for developer reference documentation, and notes that the open standards are developed in a W3C Community Group (including representatives from all major browsers) as well as a W3C Working Group. For a specific language, confirm its Wasm toolchain support in that language's own documentation; for a specific host, confirm that it supports a non-web embedding. The site itself does not publish a list of supported languages, so treat language support as a toolchain question rather than a Wasm specification question.