Overview
Minifies CSS, JavaScript or HTML in the browser with three mode-specific reducers, showing the percentage of characters saved. CSS strips comments and collapses whitespace and separators; JavaScript uses a character scanner that respects string and comment boundaries; HTML removes comments and inter-tag whitespace. No AST, no renaming, no server: paste, read the savings figure, copy the output.
How It Works
Pick the language tab, which also loads a sample so you can see the behavior immediately, then paste your code. The minified output and a saved-percent badge appear live. CSS mode deletes /* */ comments, removes spaces around braces, colons, semicolons, commas and combinators, and drops the final semicolon before a closing brace. JavaScript mode walks the source character by character, skipping line and block comments and never touching the inside of quoted strings or template literals, then trims per line and collapses whitespace around structural punctuation. HTML mode deletes comments, except conditional comments used by legacy IE, and squeezes whitespace between tags. Copy the result from the output panel.
Step-by-Step Usage Guide
- Select the CSS, JavaScript, or HTML tab for the kind of input you have.
- Paste the source; the minified output and percent saved appear immediately.
- Spot-check the output, especially around string literals in JS or inline elements in HTML.
- Copy the minified result and measure the real transfer win after server-side compression.
Technical Specifications & Standards
The three modes have very different safety profiles, and knowing them prevents surprises. The JS reducer is a small state machine tracking three states: inside a single or double quoted string, inside a template literal, or inside a line or block comment; everything outside those states passes through, and only line-joining and punctuation-adjacent whitespace is removed. It will not rename variables, remove dead code, or shorten properties, so it is safe in the sense that behavior is preserved, but the savings are far smaller than a real bundler's pass. It also does not distinguish regular expression literals from division, so an unquoted regex containing quote characters can confuse the string detector in rare cases; review output before shipping. The CSS mode is regex-driven and collapses whitespace after comment removal, which is safe for standard stylesheets but can join declarations in ways that matter for old-browser hacks that rely on spacing. The HTML mode's comment stripping preserves conditional comments but removes ordinary ones, and the whitespace collapse between tags can merge inline elements in ways that change rendering where whitespace is visually meaningful, such as spaced links in a nav bar.
Targeted Use Cases
- Squeezing a small standalone stylesheet or script for a widget where a bundler is overkill.
- Stripping comments from HTML templates before committing them to a CMS.
- Estimating how much of your payload is comments and whitespace versus real code.
- Producing compact one-off assets for email or embedded contexts with strict size budgets.
Notes & Gotchas
- Do not treat this as a replacement for Terser or esbuild in a build pipeline; savings and safety checks are smaller.
- Verify JS output around template literals and regular expressions before deploying.
- Watch inline-element spacing in HTML output, where collapsed whitespace can visibly change layout.
- Measure again after gzip; whitespace-heavy code compresses well, so the real network saving is smaller than the shown percentage.
Frequently Asked Questions
Does the JavaScript minifier rename variables or remove dead code?
No. It only removes comments and collapsible whitespace while protecting string and template literal contents. Variable renaming and dead-code elimination need a real minifier such as Terser or esbuild.
Will strings inside my JavaScript be altered?
No. The scanner tracks single quotes, double quotes and backtick template literals and copies their contents through untouched, including escaped characters. Comments inside strings are also preserved.
Why is my HTML layout different after minifying?
Whitespace between inline elements renders as a space in browsers. Collapsing it removes those visible spaces, which can close gaps between inline links or icons. Check such spots or keep them on one line in the source.
Are conditional comments in HTML removed?
No. The HTML mode skips comments that begin with a condition, so legacy IE fallbacks survive; ordinary comments are removed.