JavaScript Minifier
Minify modern JavaScript and ES modules with Terser, with optional name shortening and source maps.
JavaScript Minifier
For code that relies on fn.name or class names (e.g. some frameworks and error reports).
Keeps /*! … */, @license and @preserve comments.
Lets browser dev tools show your original code when debugging.
Comma- or space-separated. These are never renamed.
Paste code, choose a file or drop one here (up to 2.00 MB). Everything runs in your browser — the code isn't uploaded or run.
Your data is processed locally in your browser and is not uploaded to OZVILO servers.
How to use the JavaScript Minifier
- 1Paste JavaScript, choose a .js or .mjs file, or drop one onto the box.
- 2Choose the level: compress and shorten names, compress only, or whitespace and comments only.
- 3Optionally keep function and class names, list names to keep, or create a source map.
- 4Press Minify JavaScript, then copy the result or download the .min.js (and .map) file.
Examples
Modern syntax
- Input
- const total = (items) => items?.length ?? 0;
- Result
- const total=t=>t?.length??0;
JSX
- Input
- const App = () => <div>Hi</div>;
- Result
- A clear message to compile JSX first — no broken output
JavaScript Minifier features
- Uses Terser, a maintained JavaScript minifier — no regular-expression shortcuts
- Modern syntax: ES modules, async/await, classes with private fields, optional chaining and more
- Detects ES modules; classic scripts keep their top-level (global) names
- Options: keep names, reserved names, licence comments and source maps
- Syntax errors shown with line and column; the code is never run
Frequently asked questions
Is the minified code safe to use?
Terser parses the code and prints an equivalent version, so behaviour is preserved for valid JavaScript. If your code relies on function or class names (fn.name), turn on “Keep function and class names”. Always test the result before deploying.
Does it support JSX or TypeScript?
No. Terser only reads plain JavaScript. Compile JSX or TypeScript first (for example with esbuild, Babel or tsc), then minify the output. The tool says so clearly instead of producing broken code.
What is a source map?
A .map file that lets browser developer tools show your original code when you debug the minified file. Upload it next to the .min.js file; the minified file ends with a comment pointing to it.
Is my code uploaded or executed?
Neither. Minification runs in your browser, and the code is only parsed — never run.
Related tools
- Available
CSS Minifier
Minify CSS without rewriting it: strip comments and whitespace, keep variables, media queries and fallbacks.
SEO ToolsOpen tool - Available
HTML Minifier
Minify HTML safely: remove comments and extra whitespace while keeping scripts, styles and <pre> intact.
SEO ToolsOpen tool - Available
JSON Formatter & Validator
Beautify, minify and validate JSON with clear error messages.
Developer ToolsOpen tool - Available
Page Size Checker
Measure a page's HTML, CSS, JavaScript, images and fonts — transfer and uncompressed sizes reported separately.
SEO ToolsOpen tool