JavaScript Obfuscator
WM-81Paste JavaScript and get a harder to read version that still runs the same. Strings are hidden in a lookup table, numbers become hex, and comments and spacing are removed.
Runs in your browser. Nothing is uploaded.
JavaScript
Obfuscated JavaScript
How to use it
- Paste your JavaScript into the input box.
- Choose how to hide strings: a lookup table (hex escaped or Base64), hex escapes in place, or leave them alone.
- Keep Write whole numbers in hex ticked if you want numbers hidden too.
- Click Obfuscate, copy the result and test it where you will use it.
What it changes
The tool reads your code as tokens, not as a syntax tree. It removes comments and extra whitespace, replaces each string literal with a call that looks the string up in a table at the top of the file, and writes whole numbers such as 255 as 0xff. A newline is kept wherever removing it could change how the code is read. Names of variables, functions and properties stay the same, so the logic of the program is unchanged and easy to follow with a little effort.
What it leaves alone
Template literals, regular expressions, import and export paths, object keys, and directives such as use strict are not rewritten. JSX and TypeScript are not supported. This is not security: the lookup table is readable, and Base64 is only an encoding. Treat it as a way to make casual copying harder, and keep secrets and licence checks on a server.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Comment is never closed at line 1, column 1 | A /* comment was opened but the closing */ was not found. | Close the comment, or remove it. |
String is never closed at line 1, column 9 | A quote was opened and the line ended before the matching quote. | Add the closing quote, or use a template literal for multi-line text. |
Questions people ask
Is obfuscated JavaScript safe from copying?
No. Anyone can run it in a browser, and tools can reverse these changes. Obfuscation raises the effort a little but does not protect secrets, API keys or licence logic.
Will the obfuscated code behave the same?
It is meant to. Only string literals, whole numbers, comments and whitespace are rewritten. Always run your own tests on the output, because this tool was checked on sample programs, not on every possible script.
Does it rename my variables?
No. Renaming safely needs a full parser that understands scope, and this tool does not have one. Names, properties and the structure of the code stay as you wrote them.
Does obfuscating make the file bigger?
Usually yes for string heavy code, because a lookup table and escapes take more characters than the plain strings; removing comments and spaces makes it smaller. Compare the sizes of your own file before and after.
Can it obfuscate a Node.js or ES module file?
Yes for plain JavaScript. Import and export paths are left as written, and the lookup table is added at the top after any use strict directive.
What does the Base64 option do?
It stores each string as Base64 text in the table and decodes it when it is used. This hides the words from a quick search of the file but adds a small decode step each time a string is read.
About this tool
This is light obfuscation, not protection: anyone with a browser can undo it, so never use it to hide secrets or licence checks. It removes comments, collapses whitespace, moves string literals into a lookup table (or writes them as hex escapes), and writes whole numbers in hex. Variable, function and property names are not renamed, and the program flow is not changed, because renaming needs a full parser. Template literals, regular expressions, import and export paths, object keys and "use strict" style directives are left as written. It reads plain JavaScript, so JSX and TypeScript are not supported. Strings that use legacy octal escapes or hold a lone surrogate are kept as written. The output is checked only by tests on sample programs, so run your own tests on the result.