Original: 0 chars | Minified: 0 chars
How it works
The JavaScript Minifier removes whitespace, comments, and optional syntax from JavaScript code to reduce file size, producing output that executes identically to the original but in fewer bytes.
JavaScript is the largest contributor to page weight in most modern web applications. Reducing JS bundle size directly improves Time to Interactive (TTI) — the metric that most correlates with user-perceived page speed. A production app typically processes JS through tools like Terser or ESBuild, but this tool handles ad-hoc minification without a build setup.
How to use it: paste your JavaScript. The minifier removes single-line comments (//), block comments (/* */), leading and trailing whitespace on lines, unnecessary semicolons, and collapses whitespace around operators and keywords. Output appears on a single line.
What this tool does vs. full minifiers: this tool performs whitespace and comment removal (safe, reversible minification). Full production minifiers like Terser also rename variables to single letters, inline constants, remove dead code, and mangle function names — producing 40–60% smaller output. Use this tool for quick size reduction; use a production build tool for maximum compression.
Size display: before and after sizes are shown in bytes with percentage reduction so you can evaluate the impact immediately.
Frequently Asked Questions
- This tool performs whitespace and comment removal only — it does not rename variables. For full minification including variable mangling, use a production tool like Terser or ESBuild.
- Yes. ES module syntax (import, export, export default) is preserved correctly. The minified output remains a valid ES module.
- Whitespace inside template literal backtick strings is never removed — it's part of the string content. Only whitespace outside string values is stripped.
- No. 'use strict' directives are preserved because removing them would change program behavior in non-strict contexts.