JavaScript Obfuscator
Remove comments, collapse whitespace, and encode string literals to make JavaScript harder to read.
Last updated: May 29, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JavaScript Obfuscator?
JavaScript Obfuscator applies lightweight transformations to make JavaScript source code harder to read without altering its behavior. It removes comments, collapses whitespace, and optionally encodes string literals as hex escape sequences (e.g. "hello" → "\x68\x65\x6c\x6c\x6f"). This is a basic, browser-based obfuscator — for production-grade obfuscation with control flow flattening and identifier mangling, consider tools like the javascript-obfuscator npm package.
How to Use JavaScript Obfuscator
Paste JavaScript into the input.
Choose obfuscation options.
Review the obfuscated output.
Copy or download the result.
Common Use Cases
- Quickly stripping comments and whitespace before deploying a script.
- Lightly protecting API keys or endpoint strings embedded in client-side JS.
- Reducing file size by removing developer comments from production scripts.
- Encoding string literals before embedding code in a CMS or email template.
Example Input and Output
A function with comments and readable strings is stripped and minified.
// Greet user
function greet(name) {
const msg = "Hello, " + name;
return msg;
}function greet(name){const msg="Hello, "+name;return msg;}Privacy
JavaScript code is processed locally in the browser and is not uploaded.

