A C++ compiler and optimizer library for WebAssembly, with the wasm-opt tool and a JavaScript build (binaryen.js).
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
Install the Emscripten SDK (emsdk) from the downloads page
- 2
Compile hello.c to a JavaScript file
emcc hello.c -o hello.js - 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
A pure WebAssembly and JavaScript port of FFmpeg that lets browsers record, convert and stream video and audio.
A modular collection of compiler and toolchain technologies, including the LLVM core, the Clang C/C++ frontend, libc++ and the LLD linker.
A TypeScript-like language and compiler that turns a typed subset of TypeScript into WebAssembly modules.
A Go compiler built on LLVM that targets microcontrollers, WebAssembly (WASM/WASI), and command-line tools.
A experimental TypeScript and JavaScript compiler that turns programs into native executables or WebAssembly, without requiring Node.js at runtime.