Protect your JavaScript source code directly in the browser. No uploads, no server, fully client-side.
๐ Live Demo: https://obscura-nine-peach.vercel.app/
- Overview
- Features
- How It Works
- Getting Started
- Obfuscation Options
- Target Environments
- Engine System
- Third-Party Libraries / APIs
- Security Headers
- Deployment
- Privacy
- File Structure
Obscura is a fully client-side JavaScript obfuscation tool built as a single index.html file. It allows developers to obfuscate their JavaScript code directly in the browser without sending any code to a server.
The tool uses a dual-engine approach:
- Full engine โ
javascript-obfuscator(primary, all features) - Lite engine โ
Terser(fallback, if primary CDN fails)
- โ
Paste or upload
.js,.ts,.mjs,.cjsfiles - โ Drag & drop file support
- โ 10+ configurable obfuscation options
- โ Dual-engine with automatic fallback
- โ Capability guard โ warns before running unsupported features
- โ Progress bar animation during processing
- โ Copy to clipboard & download obfuscated output
- โ Input/output character count + size ratio stats
- โ DevTools protection (blocks right-click, F12, Ctrl+Shift+I, etc.)
- โ Responsive layout (mobile-friendly)
- โ Built-in Help page
- โ Zero dependencies, single HTML file
- โ No analytics, no cookies, no data collection
- User pastes or uploads JavaScript code into the Input panel.
- The tool reads the selected obfuscation options.
- On clicking OBFUSCATE โ (or pressing
Ctrl+Enter):- The engine is detected (full or lite).
- A capability guard checks if any active options are unsupported by the current engine โ if so, a modal warns the user.
- The obfuscation runs entirely in the browser.
- The obfuscated code appears in the Output panel.
- User can Copy or Download the result as
.obfuscated.js.
Since Obscura is a single HTML file, no build step or installation is required.
# Clone the repository
git clone https://github.com/andiasriefail2004/ObscuraโJavaScript-Obfuscator.git
# Open directly in browser
open index.htmlOr just visit the live demo: https://obscura-nine-peach.vercel.app/
| Option | Engine | Description |
|---|---|---|
| Rename Variables | Full + Lite | Replaces all variable, function, and parameter names with short unreadable identifiers. |
| String Array | Full only | Extracts all string literals into a hidden encoded array and replaces them with lookup calls. |
| Dead Code Injection | Full only | Injects random fake code blocks that never execute, making the real flow harder to follow. โ Can increase output size by up to 200%. |
| Control Flow Flattening | Full only | Restructures every function into a flat dispatcher loop, hiding the original logical order. โ Can slow runtime by up to 1.5ร. |
| Self Defending | Full only | Makes the obfuscated code break if it is reformatted or beautified. |
| Debug Protection | Full only | Continuously forces the debugger to activate, making DevTools nearly unusable on the output. โ May freeze the browser tab. |
| Drop Console | Full + Lite | Replaces all console.* calls with empty functions, silencing runtime logging. |
| Drop Debugger | Full + Lite | Removes all debugger; statements from the output. |
| Numbers to Expressions | Full only | Converts numeric literals into complex arithmetic expressions that evaluate to the same value. |
| Split Strings | Full only | Splits string literals into smaller chunks joined at runtime, making strings harder to search. |
| Value | Description |
|---|---|
hexadecimal |
Identifiers like _0x1a2b3c |
mangled |
Short identifiers like a, b, c |
mangled-shuffled |
Short identifiers in shuffled order |
| Target | Description |
|---|---|
| Browser | Standard web page. Default โ suitable for most browser JS. |
| Browser (no eval) | Same as Browser but avoids eval(). Use with strict CSP policies. |
| Node.js | Server-side Node.js. Disables browser-specific protections relying on window/document. |
| Service Worker | Service Worker context. Uses self global instead of window. |
| Userscript | Tampermonkey / Greasemonkey sandbox. Defenses adjusted for userscript environment. |
| Bytenode | Prepares output for compilation into V8 cached bytecode (.jsc) via bytenode. |
Obscura loads the primary engine (javascript-obfuscator) asynchronously from CDN on startup. If the CDN fails to load, it falls back to Terser (lite engine).
Startup
โโโ Load javascript-obfuscator from jsDelivr CDN
โโโ Success โ window._obfEngine = 'full'
โโโ Fail โ Load source-map.js โ Load terser bundle.min.js
โโโ Success โ window._obfEngine = 'lite'
โโโ Fail โ window._obfEngine = null (shows error)
When the engine is lite, features exclusive to full (String Array, Dead Code Injection, etc.) are blocked. If the user has those options enabled, a capability modal appears before processing, listing which features will be skipped and which will still run.
Obscura loads all libraries from jsDelivr CDN โ no custom backend API is used.
| Library | Role | CDN URL |
|---|---|---|
| javascript-obfuscator | Primary obfuscation engine (full engine) | https://cdn.jsdelivr.net/npm/javascript-obfuscator/dist/index.browser.js |
| source-map | Dependency required by Terser (loaded only on fallback) | https://cdn.jsdelivr.net/npm/source-map@latest/dist/source-map.js |
| Terser | Fallback minification/obfuscation engine (lite engine) | https://cdn.jsdelivr.net/npm/terser@latest/dist/bundle.min.js |
| Google Fonts | Loads JetBrains Mono and Inter typefaces for the UI |
https://fonts.googleapis.com / https://fonts.gstatic.com |
No server-side API calls are made with user code. All processing happens in the browser.
Both deployment configurations apply the same four security headers to all routes.
| Header | Value | Purpose |
|---|---|---|
Content-Security-Policy |
(see below) | Controls which resources the browser is allowed to load |
X-Content-Type-Options |
nosniff |
Prevents MIME type sniffing |
X-Frame-Options |
DENY |
Blocks the page from being embedded in iframes |
Referrer-Policy |
strict-origin-when-cross-origin |
Limits referrer info sent to other origins |
default-src 'self'
By default, only same-origin resources are allowed.
script-src 'self' 'unsafe-inline' 'unsafe-eval'
https://cdn.jsdelivr.net/npm/javascript-obfuscator/dist/index.browser.js
https://cdn.jsdelivr.net/npm/source-map@latest/dist/source-map.js
https://cdn.jsdelivr.net/npm/terser@latest/dist/bundle.min.js
unsafe-inline is required for the inline <script> blocks. unsafe-eval is required because javascript-obfuscator uses eval() internally. Only the three specific jsDelivr CDN scripts are whitelisted.
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com
font-src 'self' https://fonts.gstatic.com
connect-src 'self'
img-src 'self' data:
object-src 'none'
base-uri 'self'
frame-ancestors 'none'
data: is allowed under img-src to support the inline SVG favicon. frame-ancestors 'none' reinforces the X-Frame-Options: DENY directive at the CSP level.
Place _headers in the root of your repository (next to index.html). Cloudflare Pages picks it up automatically.
/*
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net/npm/javascript-obfuscator/dist/index.browser.js https://cdn.jsdelivr.net/npm/source-map@latest/dist/source-map.js https://cdn.jsdelivr.net/npm/terser@latest/dist/bundle.min.js; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
The /* pattern applies the headers to every page and asset.
Place vercel.json in the root of your repository. Vercel reads it on each deployment.
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net/npm/javascript-obfuscator/dist/index.browser.js https://cdn.jsdelivr.net/npm/source-map@latest/dist/source-map.js https://cdn.jsdelivr.net/npm/terser@latest/dist/bundle.min.js; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
},
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
]
}
]
}The source: "/(.*)" regex matches every route.
- Push
index.htmlandvercel.jsonto a GitHub/GitLab repository. - Import the repository at vercel.com.
- No build command or output directory needed โ Vercel serves
index.htmldirectly. - Security headers are applied automatically via
vercel.json.
- Push
index.htmland_headersto a GitHub/GitLab repository. - Create a new Pages project at pages.cloudflare.com.
- No build command needed โ set the output directory to
/(root). - Security headers are applied automatically via
_headers.
Just serve index.html from any static file server (Nginx, Apache, GitHub Pages, etc.). Configure the security headers manually in the server config if needed.
- Your code is never uploaded or stored. All obfuscation runs entirely inside your browser.
- This tool makes no server requests with your code. The only network activity is loading the obfuscator libraries from jsDelivr CDN on first use.
- No analytics, cookies, or personally identifiable information are collected.
- Third-party libraries (
javascript-obfuscatorandTerser) are open-source and can be audited independently.
.
โโโ index.html # The entire application โ UI, styles, and logic in one file
โโโ _headers # Security headers for Cloudflare Pages deployment
โโโ vercel.json # Security headers + config for Vercel deployment
โโโ README.md # This file
MIT โ free to use, modify, and deploy.