JavaScript Obfuscator
Obfuscation raises the cost of reading your JavaScript source, not absolutely (no front-end obfuscation is bulletproof) but enough to discourage casual inspection and slow down automated scraping. This tool applies string-array encoding, identifier mangling, control-flow flattening and optional dead-code injection, with each option selectable depending on how aggressive you want to be.
How to obfuscate JavaScript
-
1
Paste the source
Any valid JS. If it relies on specific global property names from a host page, set those as reserved.
-
2
Pick techniques
String encoding (hex / base64), identifier mangling, control-flow flattening, dead-code injection, self-defending wrapper.
-
3
Pick the target profile
Browser (ES5-safe, no Node APIs), Node.js (allows `require`, `Buffer`), or low (mostly minify).
-
4
Obfuscate
The tool outputs the transformed code with a size delta. Aggressive settings can make the output 3-5x larger than the source.
Techniques and what they cost you
| Technique | Raises attacker effort | Runtime cost | Size cost |
|---|---|---|---|
| Variable renaming | Low | Negligible | Smaller (minify side effect) |
| String array encoding | Medium | Tiny (one lookup per string) | +10-30% |
| Control-flow flattening | High | Measurable (~2-5%) | +50-150% |
| Dead-code injection | Low (security theatre) | Small | +20-50% |
| Self-defending wrapper | Medium | One-time check | +5-10% |
| Debug protection | Medium (detects DevTools) | One-time check | +5% |
| VM / virtualization (premium) | Very high | Large (5-20x) | +300-500% |
What obfuscation cannot protect
- Secrets. Any constant in your front-end source is readable given enough time. API keys, auth secrets, pricing logic, never rely on obfuscation to hide these. Move them server-side.
- Algorithms with an observable output. If the browser can run it, an attacker with a debugger can observe every input and output. Obfuscation slows that down; it does not stop it.
- Automated scraping at scale. Anti-scraping depends on behavioural detection (fingerprinting, rate limits, CAPTCHA), not on source obfuscation.
When obfuscation is worth it
- Anti-tampering on embedded SDKs (licensing, ad SDKs, game clients).
- Raising the cost for low-effort copy-paste of a competing implementation.
- Making automated script classification harder for broad-spectrum scrapers.
When it is counter-productive
- You have a bundler already. Webpack + Terser in production mode already minifies and mangles locals. Adding a second obfuscation pass buys you little and inflates bundle size.
- You are optimizing for first-paint / Core Web Vitals. Aggressive obfuscation triples the bundle; that hurts FCP and LCP.
- You have to debug production. Heavy obfuscation makes Sentry stack traces nearly useless without a matching source map, and shipping the source map defeats the obfuscation.
Common mistakes
- Treating obfuscation as equivalent to encryption. It is not, it is a speed bump.
- Shipping the source map alongside the obfuscated bundle to production. That completely neutralizes the obfuscation.
- Obfuscating third-party libraries you already loaded from a CDN. You get the size penalty without any gain.
Frequently Asked Questions
No. Obfuscation is a speed bump, not a lock. A determined analyst with a debugger will recover the logic. It raises the cost enough to deter casual inspection and most automated scrapers, but it is not security.
If you access properties dynamically (obj["field_name"], Object.keys(obj)) or rely on specific function / class names for the host page, add those to the reserved list. Without that, property renaming can break external integrations.
Keep the original source. The obfuscator is a one-way transform; you cannot exactly recover the original from the obfuscated output, only a readable approximation.
Light obfuscation adds ~10-30%. Control-flow flattening plus string arrays adds 50-150%. The heaviest settings can triple the size. Check the output size counter before shipping.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.
Tool available in other languages
- Obfuscator JavaScript [ID]
- Obfuskator JavaScript [PL]
- เครื่องมือปิดบังโค้ด JavaScript [TH]
- Trình làm rối mã JavaScript [VI]
- Ofuscador de JavaScript [PT]
- JavaScript-Obfuscator [DE]
- Ofuscador de JavaScript [ES]
- مُبهِّم JavaScript [AR]
- JavaScript難読化ツール [JA]
- Obfuscateur JavaScript [FR]
- JavaScript 난독화 도구 [KO]
- JavaScript-obfuskerare [SV]
- JavaScript-obfuscator [NL]
- Offuscatore JavaScript [IT]
- Обфускатор JavaScript [RU]
- JavaScript Kod Gizleme Aracı [TR]
- JavaScript混淆器 [ZH]