Skip to content

Developer tools

JavaScript Obfuscator

JavaScript Obfuscator makes JavaScript harder to read and copy by transforming code structure and identifiers. It's useful for client-side code you want to add friction to, while keeping in mind that browser code can still be inspected.

01 / How it works

Simple steps, fast result.

  1. 01

    Paste JavaScript or open a .js file.

  2. 02

    Choose obfuscation options based on how much protection you need.

  3. 03

    Generate the obfuscated output and copy or download it.

02 / Features

What you get.

Configurable protection

Adjust options to balance readability, size, and protection.

Client-side processing

Your source code stays in the browser.

Copy/download output

Use the result directly in your build or delivery flow.

Practical defaults

Start with sensible settings, then tune when you need more control.

03 / Guide

Using JavaScript Obfuscator, in depth.

JavaScript Obfuscator rewrites your code so it still runs the same way but is very hard for a person to read and copy. Before using it, it's worth being clear about what obfuscation can and can't do. This guide covers that, explains each setting and its cost, and lists the cases where you shouldn't obfuscate at all.

What obfuscation can and can't protect

Start with the hard limit. Any JavaScript that runs in a browser has to be downloaded to the visitor's device first. Anyone can open the browser's developer tools and see it, save it, and run it. Obfuscation can't change that. It doesn't encrypt your code in a way that stops it running, and it can't hide anything the code does from a determined, skilled person with time to spare.

What it does is raise the cost of understanding the code. Variable names become meaningless, readable text is hidden, and the logic is rearranged into a tangle that does the same thing. Copying a widget, lifting a clever algorithm or tweaking a licence check becomes slow, tedious work instead of a five-minute job. For many people that's enough of a deterrent.

So the rule is simple: never put secrets in front-end code, obfuscated or not. API keys with real power, passwords, pricing rules you rely on and licence validation that matters belong on a server, where visitors can't see them.

The three protection levels

  • Low renames variables and functions to meaningless names. Strings stay readable. It's fast and has almost no effect on how quickly your code runs.
  • Medium is the default. It also hides strings and scrambles the control flow, so the order of operations is no longer obvious. It gives good protection, and code typically runs about 1.5 times slower.
  • High adds encrypted strings and the strongest transformations. The output is much larger and can run two to three times slower. Use it for small, sensitive pieces of code, not a whole application.

Size and speed costs come from the extra code that obfuscation adds: wrappers that decode strings at runtime and extra branches that make the logic hard to follow. After each run, the tool shows the size before and after and how long obfuscation took, so you can compare levels on your own file.

Extra options and what they cost

These are off by default. Each makes reverse engineering harder, and each has a downside.

  • Self-defending makes the code stop working if someone reformats it to make it readable. The downside: some tools that reformat or re-minify code during a build can trigger it too.
  • Disable console blocks console.log and similar calls, so the code reveals less while running. It also hides your own debugging output, and can hide messages from other scripts on the page.
  • Debugger protection makes the browser's developer tools freeze when someone tries to step through the code. It can also make debugging your own site miserable, so only use it on final production builds.
  • Rename globals renames top-level functions and variables too. Don't use it if other scripts, HTML attributes such as onclick, or a framework call your functions by name, because those calls will break.
  • Domain lock restricts the code to the domains you list, separated by commas. Copied to another site, it won't run. Start a domain with a dot, such as .example.com, to include its subdomains. Remember to include every domain you use, including staging.

How to obfuscate a script

  1. 01Finish and test your code first. Obfuscated code is very hard to debug.
  2. 02Paste the code or open a .js file.
  3. 03Pick a level, and open the extra options if you need them.
  4. 04Press Obfuscate, then copy or download the result.
  5. 05Test the obfuscated version on your real site, in more than one browser, before you replace the original.

Each run uses a fresh random seed, so obfuscating the same file twice gives different output. Keep your readable original in version control; you'll make every future change there and obfuscate again.

When not to obfuscate

  • Performance-critical code. Animation loops, games and code that runs on every scroll or keystroke will feel the slowdown. Use Low, or leave them out.
  • Open-source projects. If the code is published anyway, obfuscating it only makes it harder for you to debug.
  • Code that relies on names. Libraries others call, and code that uses eval or looks up properties by name, can break under heavy renaming.
  • When you just want smaller files. Obfuscation makes files bigger, not smaller. For size, use the Code Minifier instead.

Under the hood

The tool uses the open-source javascript-obfuscator library, running in a background worker in your browser so the page stays responsive even on large files at High. Your code is never uploaded. To inspect what the obfuscated code contains, the Dev Formatter can decode any Base64 strings you spot in it.

04 / FAQ

Common questions.

Does obfuscation make JavaScript impossible to reverse?

No. It makes code harder to read and reuse, but determined users can still analyze client-side JavaScript.

Will obfuscation break my code?

It can if options are too aggressive. Test the output after obfuscating.

Is my source code uploaded?

No. The obfuscation runs in your browser.