Code minification, what gets removed and what stays
Minification removes characters that are meaningful to developers but irrelevant to parsers: whitespace (spaces, tabs, newlines), comments, and redundant delimiters. The result is functionally identical to the source but as small as possible. For JavaScript, CSS, and HTML, smaller files mean faster page loads, bytes that don't travel over the network are bytes that don't slow down the browser. A 40KB formatted JavaScript file typically minifies to 18–25KB, with no change in behaviour.
Basic minification (what this tool does) removes whitespace and comments. Advanced minification, done by tools like Terser for JavaScript, also shortens variable names: userAuthentication becomes a, and complex expressions can be inlined or eliminated if a compiler proves they're unreachable. Basic minification is safe to apply to any code; advanced renaming requires a proper build pipeline because it can break code that relies on string-based reflection or property names.
| What is removed | What stays | Notes |
|---|---|---|
| Whitespace between tokens | Required whitespace (between keywords) | Safe to remove |
Line comments (//) | Licence headers (/*!.*/) | This tool removes all comments |
Block comments (/* */) | String literals (whitespace preserved) | Safe to remove |
| Trailing semicolons | Structural semicolons | Depends on language |
Where minification fits in a workflow
For projects with a build pipeline (webpack, Vite, Parcel, esbuild), minification happens automatically at build time, you don't need to manually minify. This tool is useful for: quickly minifying a one-off script or snippet you're inlining directly in HTML; testing what a minified version of a file looks like before setting up a build pipeline; reducing the size of a CSS override you're embedding in an email template; or compacting a JSON config file for an embedded device with limited storage.
Related: JavaScript formatter (restore readability), CSS formatter, JSON formatter.