javascript-obfuscator is a free, open source browsers & extensions project written in TypeScript and released under BSD-2-Clause. It has 16,257 GitHub stars, 1,741 forks and 24 open issues, and was last pushed 8 days ago. On this registry it ranks #23 of 65 tracked projects in Browsers & Extensions, with 5 head-to-head comparisons available. It gained 1 stars over the last 3 tracked days.

What is javascript-obfuscator?

JavaScript Obfuscator is a free, BSD-2-Clause licensed TypeScript obfuscator for JavaScript and Node.js source code, built for developers who need to ship browser or server-side JavaScript that is hard to read, tamper with, or reverse engineer.

What it is

JavaScript Obfuscator is an open-source obfuscation tool that lives in the npm and Node.js ecosystem. It transforms JavaScript source into functionally equivalent code that is deliberately difficult to follow, by rewriting identifiers, extracting and encrypting string literals, flattening control flow, and injecting dead code. The package ships both a command-line interface and a Node.js API, and it also provides programmatic access to the Obfuscator.io API for its commercial VM-based modes. The project is written in TypeScript, carries the BSD-2-Clause licence, and is distributed from the repository whose homepage is obfuscator.io.

The concrete problem it solves is source disclosure. JavaScript delivered to a browser, an extension store, or a customer's Node.js runtime arrives as source, which means variable names, string literals, business logic, and control flow are all plainly legible to anyone who opens the file. Pasting or beautifying that source recovers the original structure. JavaScript Obfuscator replaces the practice of shipping readable source by producing an output build in which identifiers are renamed, strings are pulled into an encrypted string array, and the shape of the original control flow is no longer visible in the emitted code.

Key capabilities

  • Variable and function renaming (identifier mangling) applied across a build.
  • String extraction with encryption through stringArrayEncoding, supporting base64 and rc4 encoding of extracted literals.
  • Control flow flattening, which restructures branching logic so the original flow is not directly readable.
  • Dead code injection, adding unreachable or misleading code paths to the output.
  • debugProtection, which freezes browser DevTools when the obfuscated script is inspected.
  • selfDefending, which makes the output break if it is beautified or reformatted.
  • A CLI plus a Node.js API, with additional paid VM bytecode obfuscation available through the Obfuscator.io API using methods such as vmBytecodeEncoding, vmJumpsEncoding, and vmMacroOps.

Who uses it and how

  • Browser and browser-extension developers who ship client-side JavaScript that users can freely download and inspect.
  • Node.js teams that obfuscate server-side bundles before distribution to customers or partners.
  • Build pipelines that invoke the CLI as a step in an existing bundling or release process.
  • Application code that calls the Node.js API directly to obfuscate source in memory rather than shelling out.
  • Commercial users who hold an Obfuscator.io token and push functions through the paid VM bytecode path, where each build produces unique opcodes and VM structure.

The project reports over 1 million npm downloads per week, and the README asks companies using it in production to send confirmation or a short reference letter describing how and why they adopted it.

Getting started

Install the javascript-obfuscator package from npm and run it either through its CLI or by calling its Node.js API in a build script. The paid VM obfuscation tier is accessed separately through the Obfuscator.io API and requires an API token.

How it compares

The free package runs offline with no network access and no token, which is the main axis separating it from the paid Obfuscator.io tier that routes work through an API and therefore requires a token and connectivity. Functionally, the free tier renames identifiers, obscures strings, flattens control flow, and detects tampering, but its output is still JavaScript and is marked in the project's own table as only partially resistant to decompilation. The paid tier adds bytecode virtualization, per-instruction bytecode encoding, stateful and decoy opcodes, and anti-LLM analysis defenses, all of which the free package lacks.

When to use it — and when not

Use it when the goal is raising the cost of reading and modifying shipped JavaScript, and when the free offline path is enough. A self-hoster needs no database, storage, or SMTP service, since the tool is a local build step, but anyone who wants genuine bytecode-level protection must instead depend on the hosted Obfuscator.io API, its token, and its network round trip. It is the wrong choice for anyone treating obfuscation as a security boundary, because the free output remains JavaScript and is documented as still vulnerable to decompilation and to automated LLM-based analysis.

project readme (upstream, from github) — read inline

JavaScript obfuscator

logo


:rocket: Obfuscator.io with VM Obfuscation

Obfuscator.io - JavaScript VM Obfuscation

Obfuscator.io adds VM-based bytecode obfuscation to this package - your JavaScript functions are compiled to custom bytecode that runs on an embedded virtual machine. Each build produces unique opcodes and VM structure, making reverse engineering and automated deobfuscation dramatically harder.

Protection goal Free (this package) obfuscator.io
Rename identifiers ✅ variable/function renaming ✅ + VM-local symbols never exposed as JavaScript
Obscure strings ✅ string array + base64/rc4 ✅ + strings embedded in bytecode constants
Obscure control flow ✅ control flow flattening ✅ full bytecode virtualization, vmJumpsEncoding (runtime-computed jump targets), vmDeadCodeInjection (fake bytecode sequences)
Resist decompilation ⚠️ output is still JavaScript ✅ custom opcodes, vmStatefulOpcodes (position-dependent opcode mapping), vmMacroOps (fused instructions), vmDecoyOpcodes (fake opcode handlers)
Resist automated LLM-based analysis ❌ fully vulnerable (no LLM-specific defenses) ✅ bytecode encryption + anti-LLM defenses in vmSelfDefending and vmDebugProtection
Encryption stringArrayEncoding (base64/rc4 on extracted strings) vmBytecodeEncoding (per-instruction encoding), vmBytecodeArrayEncoding (whole bytecode array as single block)
Anti-debugging debugProtection (freezes browser DevTools) vmDebugProtection (multi-layered anti-debugging and anti-analysis defenses)
Tamper detection selfDefending (breaks if beautified) vmSelfDefending (multi-layered tamper detection, anti-hooking, anti-reverse-engineering protection)
Runs offline, no network ❌ uses obfuscator.io API (requires token)

Visit Obfuscator.io · Pro API methods

This package provides access to Obfuscator.io API via CLI and Node.js API.


Do you use JavaScript Obfuscator at your company?

JavaScript Obfuscator has reached over 1 million npm downloads per week. I am currently preparing an EB-1 immigration case and collecting independent evidence of the project’s real-world professional usage and impact.

If you use JavaScript Obfuscator in a company project — especially at a well-known company, large organization, or widely used product — I would be very grateful if you could contact me.

Helpful evidence may include a brief confirmation or, ideally, a 1–2 page reference letter describing:

  • how your team or company used JavaScript Obfuscator;
  • why you chose it;
  • what problem it helped solve;
  • whether it was used in production or an important internal workflow;
  • your role and how you are familiar with the usage.

I can provide a simple draft/template to make this easy.

Please contact me at: [email protected]

Thank you for supporting the project.


JavaScript Obfuscator is a powerful free obfuscator for JavaScript, containing a variety of features which provide protection for your source code.

Key features:

  • VM bytecode obfuscation (via Obfuscator.io)
  • variables renaming
  • strings extraction and encryption
  • dead code injection
  • control flow flattening
  • various code transformations
  • and more...

The example of obfuscated code: github.com

Online version:

obfuscator.io

Plugins:

npm version FOSSA Status Build Status Coverage Status Backers on Open Collective Sponsors on Open Collective xscode

NOTE! the README on the master branch might not match that of the latest stable release!
If you have a question, check this section first: FAQ

:warning: Important

Only obfuscate the code that belongs to you.

It is not recommended to obfuscate vendor scripts and polyfills, since the obfuscated code is 15-80% slower (depends on options) and the files are significantly larger.

Installation

Using Yarn or NPM

Install the package with Yarn or NPM and add it to your dependencies or devDependencies:

$ yarn add --dev javascript-obfuscator

or

$ npm install --save-dev javascript-obfuscator
In a Browser

F

readme truncated — read the full docs on github

Frequently asked questions

Is javascript-obfuscator free to use?

javascript-obfuscator is open source under the BSD-2-Clause licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does javascript-obfuscator do?

A powerful obfuscator for JavaScript and Node.js

What is javascript-obfuscator written in?

javascript-obfuscator is primarily written in TypeScript. Its source is publicly available at https://github.com/javascript-obfuscator/javascript-obfuscator, and it has 16,257 GitHub stars.