How to obfuscate JavaScript (and what it is actually worth)
Obfuscation raises the cost of casually reading your code. It renames local variables to meaningless hex names, rewrites string literals so they do not show up in a text search, optionally sprinkles unreachable junk, and strips whitespace. It does not encrypt anything and it does not stop a determined reader, because the browser has to be able to run the result.
Use it for what it is good for: making a snippet on a public page less inviting to copy verbatim, or making a marketing widget less trivially editable. Do not use it as a security control. If the code contains a secret, the secret is already public.
- Paste your JavaScript into the input.
- Choose a string encoding: none, hex escapes, or base64 with an injected decoder.
- Toggle rename local identifiers, insert dead code, and minify whitespace.
- Copy the result, then run it and test it, because the token-based renamer can break code it cannot fully see.
- Ship it only for deterrence, never as a substitute for server-side protection.