JS Obfuscator
Basic JS obfuscation in your browser: short local names, comments stripped, optional hex strings.
This is basic lexical obfuscation, not encryption. It slows down casual reading and does not protect a secret. Never ship API keys, tokens or license checks inside client-side JavaScript.
Line breaks are kept. Joining lines would change how automatic semicolon insertion reads the code, so this tool does not do it.
How to use it
- Paste JavaScript into the left panel.
- Keep Rename local names to short ones on to rewrite declarations that the tokenizer can prove are local.
- Keep Remove comments and extra whitespace on to drop comments and collapse indentation; line breaks stay.
- Turn on Escape string literals as hex if you want string contents rewritten as
\x41-style escapes. - Press Obfuscate, then Copy or Download. The status line reports how many names were renamed and how much the size changed.
The rename pass is deliberately conservative: if a name appears as a property access such as obj.count, as an object key such as count:, or before its own declaration, that whole name is left alone rather than half-renamed.
Common use cases
- Shipping a snippet you would rather not read at a glance - strip the comments and the descriptive variable names before publishing a demo.
- Shrinking a small script - removing comments and indentation cuts bytes without changing behavior.
- Hiding literal text from a quick scan - hex escapes make a string unreadable to a human while the value stays identical at run time.
- Comparing before and after - the status line shows the byte count on both sides so you can see what the pass actually saved.
Why it stays private
The tokenizer and the rewrite both run in this tab. Your source, the strings inside it and any credentials accidentally embedded in it are never uploaded.
FAQ
Q: Does this protect an API key or a license check? A: No. This is basic lexical obfuscation, not encryption. Anything shipped to a browser can be read back by a determined reader, so keys and license checks belong on a server.
Q: Why does it keep line breaks instead of joining everything? A: Joining lines can change how automatic semicolon insertion reads the code, which can silently change behavior. Keeping line boundaries is the safe choice for a lexical tool.
Q: When does the rename pass skip a variable?
A: A name is skipped entirely if any occurrence is a property access, an object key or a label, if it is referenced before its declaration, or if the file contains eval or with. Skipping whole names keeps the output consistent instead of renaming some occurrences and not others.
Your data stays on this device
JS Obfuscator runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.
Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.