JavaScript Obfuscator Online — Protect JS Source Code Free
A free JavaScript obfuscator that transforms readable source code into a functionally equivalent but difficult-to-reverse version. Choose from three presets — Basic, Medium, or Strong — to balance output size against obfuscation depth. Uses the javascript-obfuscator engine with string array encoding, control flow flattening, and identifier renaming. All processing runs in your browser; your code is never transmitted to a server.
Features
Three obfuscation presets
Basic compacts the code. Medium adds Base64-encoded string arrays. Strong applies RC4 string encryption and control flow flattening for maximum protection.
String array encoding
Extracts all string literals into an encrypted array referenced by index. Reverse-engineering requires reconstructing the lookup table before any strings are readable.
Control flow flattening
Restructures if/else and switch blocks into a state-machine loop, hiding the original execution order. Available in the Strong preset.
Size impact indicator
Shows the byte overhead added by obfuscation so you can choose a preset that fits your payload budget.
How to obfuscate JavaScript online
Protect your JS source code from casual inspection in three steps.
- Paste your JavaScriptDrop your source code into the left panel. Valid ES5 or ES6+ code is accepted.
- Choose a presetSelect Basic for minimal overhead, Medium for string array encoding, or Strong for maximum obfuscation (produces larger output and is slower to process).
- Click ObfuscateThe obfuscated output appears in the right panel. Byte counts and the size overhead percentage are shown in the toolbar.
- Copy and deployCopy the output and replace your original script. The obfuscated version runs identically in all browsers.
Examples
Obfuscate a configuration object
const apiConfig = {
endpoint: "https://api.example.com/v2",
timeout: 5000,
retries: 3
};const _0x3f2a=['https://api.example.com/v2'];(function(_0x1b,_0x4c){...}(_0x3f2a,0x1a3));const apiConfig={'endpoint':_0x5e('0x0'),'timeout':0x1388,'retries':0x3};In Medium preset, string literals move into an encoded array. Numeric values are converted to hex. The original structure is preserved but hard to read at a glance.
Frequently Asked Questions
- What is JavaScript obfuscation?
- Obfuscation transforms source code into a version that behaves identically but is much harder for humans to read and reverse-engineer. It renames variables to meaningless identifiers, encrypts string literals, and optionally restructures control flow to obscure program logic.
- Does obfuscation make my code impossible to reverse-engineer?
- No. Obfuscation is a deterrent, not encryption. A determined engineer with enough time can deobfuscate any JavaScript that runs in a browser, because the browser must ultimately execute it. It raises the cost and effort of casual copying but is not a security boundary.
- What is the difference between the three presets?
- Basic: compact output with no encryption — fast, minimal overhead. Medium: adds a Base64-encoded string array that hides all string literals — moderate overhead (~20–50%). Strong: adds RC4 string encryption and control flow flattening — maximum protection but significantly larger output and slower execution.
- Will obfuscated code run slower?
- Basic and Medium have negligible performance impact. Strong obfuscation with control flow flattening can noticeably slow down hot code paths because the state-machine loop adds overhead per iteration. Avoid using Strong on performance-critical code like game loops or real-time data processing.
- Can I obfuscate TypeScript or JSX?
- The obfuscator works on plain JavaScript. Compile TypeScript or JSX to JS first, then obfuscate the output. Obfuscating before compilation will produce errors.
- Is obfuscation the same as minification?
- No. Minification reduces file size by removing whitespace and shortening identifiers. Obfuscation prioritizes making code hard to understand, which often increases file size. You can apply both: minify first, then obfuscate — or just minify if your goal is performance rather than IP protection.