JavaScript Minifier & Compressor
Produce a compact JavaScript file with explicit control over transformations that matter to your project. Start with syntax-only output, then opt into compression, name mangling or module assumptions when appropriate.
Browser-based · No account required · Copy and export
JavaScript optimization workbench
Parse and transform code locally with a pinned Terser worker. Original source is never executed.
Advanced optimization · Source maps · Presets
A source map can reveal original source. Module handling does not bundle imports. Minification does not prove behavioral equivalence, secure code or production readiness.
Optimization findings & release checks
Choose a profile and run the minifier to inspect actual output.
Gzip uses the browser's real CompressionStream when supported. No Brotli or transfer-time estimate is invented.
Batch release · Independent JavaScript files (not a bundler)
| File | Mode | Status | Bytes in → out | Actions |
|---|---|---|---|---|
| No files added. | ||||
Files are minified independently. No import rewriting, module bundling, or Node dependency installation. 30 files max, 1.5 MB each, 6 MB source total.
Runtime: Terser 5.49.2 (BSD-2-Clause, static pinned CDN dependency). No source text is uploaded; loading the runtime requires CDN connectivity unless deployed with a permitted local bundle. Output executes outside PixelOkay when you publish it—test in your own application.
How to use JavaScript Minifier & Compressor
- Paste source or load a JavaScript file. Set an output filename and select the optimization preset.
- Enable ES module mode only for module input. Choose whether function/class names and important comments should be retained.
- Minify in a worker, review the output, warnings, actual byte counts and gzip estimates, then download. Run your application's tests before publishing transformed code.
When to use this tool
Create a smaller JavaScript build artifact with explicit compression and mangling choices. Match module mode to the source and test the output in its target runtime.
Compression and mangling are separate choices
Compression rewrites expressions and removes code the engine determines is unnecessary. Mangling shortens eligible names. Module mode changes parsing and optimization assumptions for ES modules. Function and class name retention can help code that inspects names or relies on useful stack labels, but it does not preserve every identifier. The important-comment option retains exclamation and license/preserve notices recognized by Terser.
Worked example
Input: function add(a, b) { return a + b; }
Syntax-only output: function add(a,b){return a+b}
Other presets can change names or restructure eligible code. Choose script mode from the source, not the desired size
export function label(name) {
return "Task: " + name;
} - Select module handling for this authored ES-module snippet. Do not mark classic scripts as modules merely to seek smaller output.
- Start with Safe to inspect syntax compaction. Compare compression and mangling only when those transformations suit the receiving application.
- Choose function/class name retention when names matter. It does not promise to preserve every variable or parameter name.
- Review required notices and download a separate artifact. Module parsing does not bundle imports or create a multi-file application.
Authored source, no minified or executed program supplied. This is not a TypeScript transpiler, linter or behavior proof. Keep the original and review integration in your own project. Use Code Beautifier or Text Diff for readable review.
Source maps, batch releases and privacy
Generate actual source maps with a deliberate sources-content choice. Batch minification transforms independent JavaScript files rather than resolving import graphs. A source map with embedded source is publicly readable if published. Pinned Terser loads from a static CDN, but your code stays in the browser.
Limits and output checks
Submitted code is parsed, not executed. This is not a transpiler, bundler, linter or sanitizer. Source maps can be generated; batch mode processes independent JavaScript files but does not bundle modules. An input that assumes classic script behavior should not be marked as a module merely to reduce its size.
Reference: Terser minify options.
Frequently asked questions
Does module mode compile import statements away?
No. It treats input as an ES module and preserves module semantics for the selected transformations; it does not bundle dependencies.
Can I keep function names?
Enable name retention. The engine preserves function/class names under that setting, while other eligible names may still be mangled.
Can I generate source maps?
Yes. Enable source maps under Advanced. Keep original source content disabled when maps will be public. The JS and map must be deployed side by side.
Is batch mode a JavaScript bundler?
No. Each file is processed independently. Imports and external dependencies are not resolved or combined.
Does minification execute my code?
No. The browser loads a pinned Terser library, parses source and generates output locally. Source text is not uploaded.
Are byte savings the same as network savings?
No. Statistics compare raw UTF-8 source. Gzip/Brotli, caching and loading behavior affect actual transfers.
Match script mode to the source
Choose script or module handling according to the input, then select compression and name-retention options. Review the generated code before integrating it.
Scope of this workflow
Module mode does not bundle imports. The tool parses rather than runs submitted code and is not a transpiler, linter or sanitizer.
Code Beautifier Online - JS, JSON, HTML & CSS · All developer tools · Privacy policy · Contact PixelOkay