Repolode
emscripten-core

emscripten-core/emscripten

A compiler toolchain that turns C and C++ code into WebAssembly so it can run in browsers, Node.js and other Wasm runtimes.

Stars
27,734
Forks
3,572
Open issues
2,527
Last commit
4 hours ago

What is it?

Emscripten compiles C and C++ to WebAssembly using LLVM and Binaryen. Its output can run on the web, in Node.js, and in standalone Wasm runtimes. The emcc command is used like gcc or clang and produces a WebAssembly module plus a JavaScript loader, or a sample HTML page.

It provides web implementations of portable APIs such as OpenGL and SDL2, which lets existing native graphical applications be ported to the browser. Large projects such as the Unity game engine and Google Earth are cited as examples of this kind of porting.

While the focus is C and C++ through Clang, the project can also be integrated with other LLVM-based compilers, such as Rust's wasm32-unknown-emscripten target.

Key features

  • 01Compiles C and C++ to WebAssembly via LLVM and Binaryen.
  • 02Runs output in browsers, Node.js, Deno, Bun and standalone Wasm runtimes.
  • 03Provides web implementations of OpenGL and SDL2 APIs.
  • 04Usable as a drop-in replacement for gcc or clang with the emcc command.
  • 05Can generate an HTML page with a loader or a bare JavaScript file.

Use cases

  • Porting an existing C or C++ desktop application or game to run in a web browser.
  • Running native C or C++ libraries inside a Node.js project.
  • Building WebAssembly modules from C code for use in other Wasm runtimes.

Quick start

  1. 1

    Install the Emscripten SDK (emsdk) from the downloads page

  2. 2

    Compile hello.c to a JavaScript file

    emcc hello.c -o hello.js
  3. 3

    Run the generated JavaScript with Node.js

    node hello.js

Things to know

  • Setup means installing the emsdk toolchain from its downloads page, not a single package install.

Topics

FAQ

What is emscripten?
A compiler toolchain that turns C and C++ code into WebAssembly so it can run in browsers, Node.js and other Wasm runtimes. Emscripten compiles C and C++ to WebAssembly using LLVM and Binaryen. Its output can run on the web, in Node.js, and in standalone Wasm runtimes. The emcc command is used like gcc or clang and produces a WebAssembly module plus a JavaScript loader, or a sample HTML page.
Is emscripten free to use? What license does it have?
emscripten is open source under the Other license. Check the license terms before using it in commercial products.
Is emscripten still maintained?
Actively maintained. The last commit to emscripten was on Oct 21, 2026.
What can I use emscripten for?
Porting an existing C or C++ desktop application or game to run in a web browser. Running native C or C++ libraries inside a Node.js project. Building WebAssembly modules from C code for use in other Wasm runtimes.
How do I install emscripten?
Install the Emscripten SDK (emsdk) from the downloads page Compile hello.c to a JavaScript file: emcc hello.c -o hello.js Run the generated JavaScript with Node.js: node hello.js
Where can I get emscripten?
The source code and installation instructions are on GitHub: https://github.com/emscripten-core/emscripten

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects