This tool is a basic JavaScript packer. You paste plain JavaScript, and it wraps your code in a disguise: the source is Base64-encoded, the resulting string is reversed, and the whole thing is hidden behind a short eval wrapper that decodes and runs it in the browser. The output looks like noise to a casual reader scrolling through your page source, and that is the entire point. What this tool is not is equally important: it is not encryption, not real security, and not a defense against anyone who actually wants to read your code.
Use it for the honest reasons: deterring lazy copying of a small demo or widget, hiding an Easter egg or a puzzle answer, or making a pasted snippet less obvious at a glance. Do not use it to protect API keys, license checks, game logic, or anything with real value, because a single atob call undoes everything this packer adds. This page explains exactly what the transformation does, how to run the result, what overhead and restrictions you accept, and the situations where you should not use it at all.
What the Packer Actually Does, Step by Step
The transformation is deliberately simple and fully reversible. Understanding each step tells you both how to deploy the output and how trivially it can be undone.
- Your original code is converted to UTF-8 bytes and Base64-encoded, so a line like var x = 42; becomes something like dmFyIHggPSA0Mjs=.
- The encoded string is reversed character by character, so the Base64 signature characters at the end move to the front. This defeats people who scan page source for atob wrappers by eye.
- The packer emits a tiny runner that undoes both steps at runtime: it reverses the string back, passes it to atob to decode, and hands the result to eval to execute. The wrapper also carries the UTF-8 handling so non-ASCII characters in your code survive the round trip.
A concrete example makes the size cost visible. Take the 21-character statement var greeting = "hi";. Base64 encoding alone expands it to 28 characters, and after reversal and the wrapper, which is roughly 90 characters of runner code, the packed output is around 120 characters for 21 characters of input. The overhead follows a fixed pattern: Base64 expands data by exactly 4 characters per 3 input bytes, about 33 percent, and the runner adds a constant of roughly 90 to 120 characters. On a 10 KB script you end up with about 13.5 KB plus the wrapper.
How to Use This Tool (Step by Step)
- Paste or type the JavaScript you want packed. Keep it to self-contained code that does not depend on being readable, debuggable, or source-mapped later.
- Click the pack button. The packed output appears in the result panel, ready to copy.
- Test the output immediately in a real page or console. If your original code threw a syntax error, the packed version will too, just less readably.
- Ship the packed string where you would have shipped the original: inline in a script tag, inside your own file, wherever the eval-based wrapper is allowed to run.
- Keep the original source. There is no unpack button here on purpose; the person who packed the code should always retain the readable original, because debugging packed output is miserable.
Running the Packed Output
The packed string executes the same way normal JavaScript does, because at run time the wrapper simply decodes and evals your code. Paste it into a script tag and the browser runs it exactly as if you had written the original. One practical detail matters: the wrapper needs eval to be available, so any environment that forbids eval will refuse the packed code even though the original would have worked fine.
| Environment | Does packed code run? | Why |
|---|---|---|
| Ordinary web page, inline script | Yes | eval is available by default |
| Page with a strict CSP (no unsafe-eval) | No | Content Security Policy blocks eval entirely |
| Chrome extensions (Manifest V3) | No | eval is disallowed in extension pages |
| Some sandboxed iframes | Depends | sandbox tokens can remove eval capability |
That CSP row deserves emphasis. A Content Security Policy without unsafe-eval is one of the best cheap defenses a site can deploy, and this packer's output is incompatible with it by construction. If your project has a strict CSP, packing is simply not an option, and no amount of tweaking the wrapper changes that.
When NOT to Use This Tool
- Protecting secrets. API keys, tokens, and passwords inside packed JavaScript are still in your page, merely encoded. Anyone can unpack them in under a minute with a one-line reverse, decode, and eval-replacement. Treat client-side secrets as public, packed or not.
- Enforcing licenses or paywalls. Any logic that runs in the user's browser is user-controllable. Packed license checks get bypassed routinely; enforcement belongs on a server.
- Production performance-critical code. The eval wrapper costs a parse on every load and blocks some optimizations. For production, minification with a real tool like Terser gives smaller output without eval, plus source maps for debugging.
- Anything under a strict CSP. As covered above, packed code and eval-restricting policies are mutually exclusive.
- Compliance or legal protection. Obfuscated code that collects data or tracks users looks worse to auditors, not better, and obfuscation does not change what privacy laws require.
This Versus Real Minification and Obfuscation
It helps to place this tool on the spectrum of JavaScript protection, from weakest to strongest:
- This packer (base64 + reverse + eval): seconds to undo, adds 33 percent size overhead, requires eval. Good for pranks, demos, and puzzles. Not for security.
- Minifiers such as Terser: rename variables, remove whitespace and comments, apply dead-code elimination. Not aimed at secrecy at all, but they shrink output by 30 to 60 percent and remain CSP-compatible and debuggable with source maps.
- Real obfuscators such as javascript-obfuscator: string arrays with rotation, control-flow flattening, dead-code injection, self-defending checks. These raise the effort needed to understand code from minutes to hours, though a determined reverse engineer still wins eventually.
- Moving the logic server-side: the only approach that genuinely keeps code away from users. If the algorithm must stay secret, it must run on a machine you control.
Notice what all client-side options share: the code arrives on the user's machine and must be executable there, so it can always be recovered by someone patient. The only real variable is how much time and skill the recovery takes.
How to Unpack Output Like This (Know Your Enemy, and Yourself)
Knowing how trivially this scheme reverses is the best cure for over-trusting it. Anyone can undo the packer by replacing the eval call with a logging call: run the wrapper with eval swapped for console.log, or manually reverse the string, feed it through atob, and read the result. Our sister tool, the JavaScript deobfuscator, does exactly this unpacking automatically for eval and atob wrappers, including the reversed-string variant this packer produces. That symmetry is deliberate: pack and unpack are two views of the same transform, and seeing both sides in five minutes teaches more about obfuscation than an hour of theory. If you packed something and lost the original, that deobfuscator is also your recovery path.
Tips and Best Practices
- Fix your code before packing. Packed output hides error line numbers and stack traces, so debug first, pack last.
- Test on the target browsers after packing, especially if your code uses non-ASCII strings, since encoding round trips are where subtle bugs appear.
- Version the original source, not the packed output. If you ever need to change one line, repacking from source beats hand-editing an encoded blob.
- For small widgets where you want light deterrence plus smaller files, consider minifying instead; it is faster at runtime and friendlier to your CSP.
- Never let a packed script lull you into shipping something sensitive client-side. Ask instead: could this check run on the server? If yes, move it there.