Emscripten

Emscripten is an LLVM to JavaScript compiler. It takes LLVM bytecode (e.g. generated from C/C++ using Clang, or from another language) and compiles that into JavaScript, which can be run on the Web.

Important: This page provides a very brief introduction to what Emscripten is. To get started with Emscripten, go to the official Emscripten Wiki.

Using Emscripten, you can

  • Compile C and C++ code into JavaScript
  • Compile any other code that can be translated into LLVM bytecode into JavaScript.
  • Compile the C/C++ runtimes of other languages into JavaScript, and then run code in those other languages in an indirect way (this has been done for Python and Lua)!

Emscripten makes native code immediately available on the Web: a platform that is standards-based, has numerous independent compatible implementations, and runs everywhere from PCs to iPads.

With Emscripten, C/C++ developers don’t have the high cost of porting code manually to JavaScript — or having to learn JavaScript at all. Web developers also benefit, as they can use the many thousands of pre-existing native utilities and libraries in their sites.

Practically any portable C or C++ codebase can be compiled into JavaScript using Emscripten, ranging from high performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like Qt.

Emscripten generates fast code — its default output format is asm.js , a highly optimizable subset of JavaScript that can execute at close to native speed in many cases.

  • Our Games zone contains some useful content related to games development, which is a common area of use for Emscripten.
  • Our Emscripten techniques page is a place to store useful Emscripten-related ideas that haven't made it onto the Emscripten Wiki.

Document Tags and Contributors

 Contributors to this page: PinZhang, chrisdavidmills, xfq, wbamberg, evilpie, Sheppy, fscholz
 Last updated by: PinZhang,