JavaScript Obfuscator (Local Variables, String Array, Minify)

Makes a JavaScript file harder to read by renaming local variables, moving string literals into one array, writing numbers and strings in hex and removing comments and white space.

Use the tool

Why this tool exists

Obfuscation does not protect secrets, but it can slow down casual copying of client-side code. Many obfuscators need a full parser. This one limits itself to transforms that are safe on tokens plus a conservative scope analysis, and tells you what it left alone.

Renaming only touches names declared inside functions that are plain var, let, const, parameters and function declarations, and only where the name is never used as a property key, shorthand property, destructured name, arrow parameter, catch parameter, class or method name. If the code contains eval, with or new Function, renaming is skipped. Top-level names are never renamed, because other scripts may use them. Output was checked by running original and obfuscated code, including a 250 KB parser library whose results were identical.

How to use it

  1. Paste your JavaScript.
  2. Choose the transforms you want; string array and renaming are on by default.
  3. Copy the result and run your tests, since obfuscated code can behave differently in unusual cases.
  4. Use the same seed to get reproducible output.

Frequently asked questions

Is it safe?

The listed transforms are conservative and were verified by running real code before and after. The tool re-parses the output with the built-in parser when it can read your code, and refuses to return output that does not parse.

What is not done?

No control flow flattening, dead code, self-defending code or domain locking. Those need a full parser or runtime tricks.

Why are some names not renamed?

Names that appear in destructuring, arrow parameters, shorthand properties, class bodies, catch clauses or as top-level declarations are left alone, because a wrong rename would change behaviour.

Does it make code unreadable for tools?

Anyone can undo hex escapes and a string array with a formatter. Treat it as a speed bump.