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
Workspace
PixelOkay · Developer toolsLoads Terser via CDN. Mangling may affect code that relies on function or variable names; always run tests on the output.
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 and byte counts, 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.Limits and output checks
Submitted code is parsed, not executed. This is not a transpiler, bundler, linter or sanitizer. Source maps and multi-file bundling are not generated here. 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.
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