There are a few compilers that translate JavaScript and TypeScript to C:

  • QuickJS compiles JavaScript to C using an embedded JavaScript engine. This implementation is fairly complete, unlike the other compilers listed here.
  • ts2c translates JavaScript and TypeScript source code to C, but it only supports a small subset of JavaScript's features.
  • NectarJS compiles a subset of JavaScript to C or WebAssembly.

Similarly, it may be possible to compile some statically-typed JavaScript programs to WebAssembly using AssemblyScript, and then decompile them to C using wasm2c.

Alternatively, it might be possible to compile JavaScript to another language that compiles to C:

  • Compile JavaScript to Python, and then compile Python to C using Cython or RPython. Since these compilers are compatible with a subset of Python, this should allow a subset of JavaScript to be translated to C.
  • Compile JavaScript to Lua using Castl, and then translate the Lua code to C using lua2c.
Answer from Anderson Green on Stack Overflow
๐ŸŒ
GitHub
github.com โ€บ andrei-markeev โ€บ ts2c
GitHub - andrei-markeev/ts2c: Convert Javascript/TypeScript to C ยท GitHub
Convert Javascript/TypeScript to C. Contribute to andrei-markeev/ts2c development by creating an account on GitHub.
Starred by 1.4K users
Forked by 96 users
Languages ย  C 60.3% | TypeScript 39.1%
๐ŸŒ
Andrei-markeev
andrei-markeev.github.io โ€บ ts2c
ts2c - Convert JavaScript/TypeScript to C
ts2c - Convert JavaScript/TypeScript to C GitHub ยท Please note: Many features aren't supported yet. See COVERAGE.md for details.
Discussions

Convert javascript code to c code - Stack Overflow
Is there any way to convert C code to JavaScript and from JavaScript to C? I found V8 juice which can generate JavaScript-side classes from C++, but it's only one way (C++ to JavaScript). I'm not More on stackoverflow.com
๐ŸŒ stackoverflow.com
JavaScript to C: Can you do this without an online code translator/converter?
Why would you want to. The code translate is by far the easiest was to go. Javascript has a simple and well-defined syntax and not hard to write a simple parser to extract. More on reddit.com
๐ŸŒ r/C_Programming
6
0
November 17, 2024
Automated way to port Javascript to c++ - Software Recommendations Stack Exchange
Is there any program which does this? I mean, V8 does this at runtime under the hood, but is there any way to output the c++ code? We need a javascript to c++ converter or translator. More on softwarerecs.stackexchange.com
๐ŸŒ softwarerecs.stackexchange.com
March 25, 2015
๐Ÿš€ [Project] JS-CMP: A JavaScript-to-C++ Transpiler โ€” Feedback Welcome!
Why am I getting heavy "written by llm" vibes off the articles on the PoC site? EDIT: Ah, OP is "correct_prompt" and two of the three humans behind the project are nr 1: ๐Ÿ“˜ MSc Artificial Intelligence student at the University of Kent (UK) nr 2: ๐ŸŒฑ I'm specializing in machine learning and artificial intelligence so the vibes are probably there because it's written by LLM. More on reddit.com
๐ŸŒ r/cpp
30
14
June 18, 2025
๐ŸŒ
GitHub
github.com โ€บ ammer โ€บ js2c
GitHub - ammer/js2c: A tool to transform javascript to C ยท GitHub
js2c is a command line tool to translate javascript to c code.
Author ย  ammer
๐ŸŒ
GitHub
github.com โ€บ timruffles โ€บ js-to-c
GitHub - timruffles/js-to-c: Compiled implementation of Javascript, targeting C (for fun)
Compiled implementation of Javascript, targeting C (for fun) - timruffles/js-to-c
Starred by 95 users
Forked by 12 users
Languages ย  HTML 96.0% | C 2.4% | TypeScript 0.9% | CSS 0.3% | JavaScript 0.2% | Makefile 0.1% | HTML 96.0% | C 2.4% | TypeScript 0.9% | CSS 0.3% | JavaScript 0.2% | Makefile 0.1%
Top answer
1 of 6
50

There are a few compilers that translate JavaScript and TypeScript to C:

  • QuickJS compiles JavaScript to C using an embedded JavaScript engine. This implementation is fairly complete, unlike the other compilers listed here.
  • ts2c translates JavaScript and TypeScript source code to C, but it only supports a small subset of JavaScript's features.
  • NectarJS compiles a subset of JavaScript to C or WebAssembly.

Similarly, it may be possible to compile some statically-typed JavaScript programs to WebAssembly using AssemblyScript, and then decompile them to C using wasm2c.

Alternatively, it might be possible to compile JavaScript to another language that compiles to C:

  • Compile JavaScript to Python, and then compile Python to C using Cython or RPython. Since these compilers are compatible with a subset of Python, this should allow a subset of JavaScript to be translated to C.
  • Compile JavaScript to Lua using Castl, and then translate the Lua code to C using lua2c.
2 of 6
48

Very, very tricky --- Javascript is a heavily dynamic language where pretty much everything can be changed at run time: names of variables, functions, types, etc. As such it maps very badly onto C. And that's not even considering eval(), which will let you construct arbitrary chunks of Javascript in strings and run them.

Any Javascript translator would have to be able to cope with such things, which means it would have to translate the Javascript into C at run-time --- which makes it a JIT, which you're already using.

You may want to look at writing C bindings for Javascript instead. These will allow your Javascript code to call out to C code and vice versa. This would allow people to write plugins in C, compile them into .so shared libraries, which you can now load and run from your Javascript code. This means you don't need to translate anything.

Javascript's not my area so I can't recommend any particular mechanism, I'm afraid --- but I'd be very surprised if V8Juice, which you've already found, didn't let you do this.

๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ javascript to c: can you do this without an online code translator/converter?
r/C_Programming on Reddit: JavaScript to C: Can you do this without an online code translator/converter?
November 17, 2024 -

This Web site Convert JavaScript to C using AI claims

Source-to-source code translation from JavaScript using AI involves utilizing natural language processing (NLP) techniques and machine learning algorithms to analyze and understand source code

And spits out C that works when compiled to achieve the same result (minus dynamic arguments passing) as JavaScript.

How would you go about achieving this locally?

๐ŸŒ
GitHub
github.com โ€บ DreamerDeLy โ€บ HTML-To-Cpp-Py
GitHub - DreamerDeLy/HTML-To-Cpp-Py: Simple script for minify HTML/CSS/JS/SVG files and convert to C++ variables for using in Arduno/ESP projects. ยท GitHub
Simple script for minify HTML/CSS/JS/SVG files and convert to C++ variables for using in Arduno/ESP projects. - DreamerDeLy/HTML-To-Cpp-Py
Author ย  DreamerDeLy
๐ŸŒ
GitHub
github.com โ€บ JS-CMP โ€บ JS-CMP
GitHub - JS-CMP/JS-CMP: JS-CMP is a C++ transpiler that converts JavaScript code into optimized C++ binaries, allowing JavaScript developers to harness C++ performance. ยท GitHub
JS-CMP is a transpiler that converts JavaScript code into C++ code, and then compiles the generated C++ code into a binary. It enables JavaScript developers to leverage the performance of C++ by converting their JavaScript codebases into optimized ...
Author ย  JS-CMP
Find elsewhere
๐ŸŒ
DEV Community
dev.to โ€บ victornu โ€บ project-js-cmp-a-javascript-to-c-transpiler-feedback-welcome-23o3
๐Ÿš€ [Project] JS-CMP: A JavaScript-to-C++ Transpiler โ€” Feedback Welcome! - DEV Community
June 18, 2025 - We're also open to contributors or curious observers! ๐Ÿ”— GitHub (main repo): https://github.com/JS-CMP/JS-CMP ๐Ÿ—๏ธ Organization + submodules: https://github.com/JS-CMP ๐ŸŒ Early POC Website: https://js-cmp.github.io/web/
๐ŸŒ
CodeConvert AI
codeconvert.ai โ€บ javascript-to-c-converter
Online JavaScript to C Converter
Instantly convert JavaScript to C code with AI. Free, fast, and accurate code translation.
๐ŸŒ
GitHub
github.com โ€บ timothycrosley โ€บ jiphy โ€บ issues โ€บ 16
Translating JavaScript source code into other programming languages ยท Issue #16 ยท timothycrosley/jiphy
January 8, 2016 - Jiphy is an excellent tool for translating Python source code into JavaScript and vice-versa, but it doesn't appear to generate code in other languages yet. I think we could make this translator more versatile since my own Transpiler-generator system can translate JavaScript and Java code into Ruby and several other programming languages.
๐ŸŒ
GitHub
github.com โ€บ ChristmasCatt โ€บ JS-to-CSharp-Converter
GitHub - ChristmasCatt/JS-to-CSharp-Converter: Example JavaScript to C# Code Converter ยท GitHub
Example JavaScript to C# Code Converter. Contribute to ChristmasCatt/JS-to-CSharp-Converter development by creating an account on GitHub.
Author ย  ChristmasCatt
๐ŸŒ
GitHub
github.com โ€บ Greentube โ€บ Java-converter
GitHub - Greentube/Java-converter: A java-to-javascript and java-to-C# source to source compiler. ยท GitHub
A java-to-javascript and java-to-C# source to source compiler. - Greentube/Java-converter
Starred by 8 users
Forked by 7 users
Languages ย  Java 57.6% | C# 24.3% | JavaScript 17.8% | HTML 0.3%
๐ŸŒ
GitHub
github.com โ€บ topics โ€บ converter
converter ยท GitHub Topics ยท GitHub
Reload to refresh your session. ... All 8,212 Python 2,046 JavaScript 1,268 HTML 683 TypeScript 648 C# 510 Java 448 Go 347 C++ 284 PHP 247 C 200 ... shell bash zsh converter csh binary perl compile shell-script ksh sh shellscript shell-scripts rc shc ash tcsh tsh rsh bsh
๐ŸŒ
CodeConvert AI
codeconvert.ai โ€บ javascript-to-c++-converter
Free JavaScript to C++ Converter โ€” AI Code Translation | CodeConvert AI
Instantly convert JavaScript to C++ code with AI. Free, fast, and accurate code translation โ€” 60+ languages supported, no signup required.
๐ŸŒ
Bun
bun.com โ€บ blog โ€บ compile-and-run-c-in-js
Compile and run C in JavaScript | Bun Blog
September 18, 2024 - From compression to cryptography to networking to the web browser you're reading this on, the world runs on C. If it's not written in C, it speaks the C ABI (C++, Rust, Zig, etc) and is available as a C library. C and the C ABI are the past, present, and future of systems programming. That's why in Bun v1.1.28, we introduced experimental support for compiling and running native C from JavaScript
๐ŸŒ
Syntha
syntha.ai โ€บ converters โ€บ javascript-to-c
Free JavaScript to C Code Converter | Online Programming Language Transformer
Copy the converted C code and use it in your project. We prioritize your code's security and privacy. Your code is not stored on our servers and is only temporarily processed for conversion. We use OpenAI's secure servers for the conversion process, ensuring your code remains confidential. JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complimentary to and integrated with Java.
๐ŸŒ
CodingFleet
codingfleet.com โ€บ code-converter โ€บ javascript โ€บ c
Javascript to C Converter - CodingFleet
Convert your Javascript Code to C. This exceptional AI-powered tool converts your Javascript code into C code easily, eliminating the need for manual re-coding. Save your precious time and unlock cross-platform development like never before with our converter tool.
๐ŸŒ
Favtutor
favtutor.com โ€บ javascript-to-c-converter
Free Javascript to C Converter Online
Use this AI tool by FavTutor to convert JavaScript code to C programming language online in a single click for free.