Type a tool name, for example "keyword density" or "transcript".
Encode JavaScript strings and conservatively reduce comments and spacing. Variable renaming is unavailable.
Up to 500,000 characters. Regex and template tails remain unchanged to preserve behavior. Obfuscation does not protect secrets.
A JavaScript obfuscator rewrites your code so it is harder for people to read while it still runs the same way. This free tool encodes string literals, removes comments and reduces horizontal spacing for scripts up to 500,000 characters. You paste your code, click one button, and copy the result along with a size comparison.
JavaScript obfuscation is the practice of transforming source code into a form that behaves identically but is difficult for a human to understand. Browsers download JavaScript as plain text, so anyone can open developer tools and read it. Obfuscation raises the effort needed to study your logic, copy it or tamper with it.
Obfuscation is not the same as minification. A minifier shrinks files to load faster. An obfuscator aims to hide meaning, and size is a side effect. The two overlap, because removing comments and whitespace does both jobs: it cuts bytes and strips the explanations that make code easy to follow.
Encryption needs a key to be reversed. Obfuscated code needs no key, because the browser must be able to run it as is. That means a determined person can always work backward. Treat obfuscation as a speed bump, never as a lock.
The tool applies three conservative transformations that you can switch on or off, and it deliberately avoids risky ones.
The Rename variables checkbox is visible but disabled. Renaming safely needs a scope-aware parser that understands which names are local, global, properties or labels, and this tool does not include one. Guessing would break working code, so the option stays off.
The tool also stops early at constructs it cannot judge safely. When it reaches a template literal (backticks), a regex literal, or text that looks like markup, the remaining code from that point on is passed through unchanged. That is why a result can look only partly obfuscated. It is a safety choice, not a bug.
You can obfuscate JavaScript in under a minute, and nothing needs to be installed or downloaded.
If you click the button with an empty box, you will see the message "Please enter JavaScript code." If your input is longer than the limit, you will be told to use at most 500,000 characters.
Here is a realistic input, similar to the sample text in the box:
function greet(name) { var message = 'Hello, ' + name + '!'; console.log(message); return message; }
Suppose the function sits in a file with a comment above each line explaining what it does. After you click Obfuscate Code, the comments are gone, runs of spaces are trimmed, and the text inside 'Hello, ' and '!' is encoded so it is no longer readable at a glance. The variable names greet, name and message stay exactly as written, because renaming is unavailable.
Now the size line. Say the original file is 2.00 KB and the output is 1.70 KB. The reduction is (1 - 1.70 / 2.00) x 100, which is 15.0%. Heavy commenting pushes this number up. Encoding many strings can push it down, and the figure can even go negative if the encoded text is longer than the original. Both outcomes are normal.
The result panel gives you the obfuscated code plus three size numbers, and each tells you something different.
Scan the output. If the last part still looks like your original code, the tool stopped at a backtick, a regex or markup-like text and kept the tail unchanged. To get fuller coverage, move template-literal or regex-heavy code into a separate file and obfuscate only the parts without them.
Paste the output into a test page and exercise every feature. To confirm nothing changed in behavior, compare the original and the output with a code diff tool, and to read dense output again, run it through a JavaScript formatter.
Obfuscation helps when you ship client-side code that you would prefer not to hand over in a readable form. These are realistic situations:
If you only want faster downloads, a minifier is the better fit. If you want an overview of related utilities, the web developer tools hub lists more.
Most problems come from treating obfuscation as security or from skipping the test step.
The tool itself warns that obfuscation does not protect secrets. API keys, passwords and private tokens must stay on your back end. Encoding a key is not hiding it. Even a Base64 encoder only changes the format, and anyone can reverse it in seconds.
You cannot reliably turn obfuscated output back into your clean code. Store the readable version in version control and treat the obfuscated file as a build artifact. Edit the original, then obfuscate again.
Libraries are already public, and obfuscating them adds size and risk without any benefit. Obfuscate only your own code.
This tool is intentionally conservative, so its protection is lighter than that of full commercial obfuscators. It does not rename variables, flatten control flow, insert dead code or add self-defending checks. Anyone who wants to read the output can paste it into a code beautifier to restore line breaks and indentation, and encoded strings can be decoded by hand or with simple scripts.
Searchers often ask how to decode or reverse JavaScript obfuscation. This page only creates obfuscated output and does not decode existing scripts. The practical lesson is that anything the browser can run, a person can eventually read. Use obfuscation to slow down casual copying, and pair it with server-side checks, licensing and legal terms for real protection.
Ready to try it? Paste your script into the box above, choose your options and click Obfuscate Code to get a cleaner, harder-to-read version and see exactly how many kilobytes you saved.
Your report has been submitted. We will look into this issue.
A VPN changes your network exit. It does not guarantee anonymity.
Themes, plugins, code, video, audio, graphics & more from 90,000+ authors.
Web Development
Design & Media
Unlimited Access
Explore Envato Market