✦ tomai
Free · Developer Tools

HTML CSS JS Minifier

Shrink HTML, CSS and JavaScript for faster pages

Input
Output

What is an HTML CSS JS minifier?

A minifier shrinks HTML, CSS and JavaScript by deleting everything the runtime does not need: comments, redundant whitespace, blank lines and superfluous punctuation. The principle differs per tab: HTML collapses whitespace runs between tags and strips comments while leaving pre and textarea content byte-identical, CSS removes comments then collapses structural whitespace with quoted string values stashed behind placeholders so a content string is never mangled, and JavaScript runs a tokenizer that knows strings, template literals, regex literals and both comment styles, dropping only true comments.

Shipping lighter pages, stylesheets and scripts

  • Switch between the HTML, CSS and JS tabs, try each bundled sample, and press one button to see before and after byte counts plus a saved-percentage readout, then copy the result or download it as a minified file with the matching extension.
  • Feed it a commented stylesheet or a chatty script before deploy and get back compact output where quoted text, regex bodies and preserved HTML blocks survived untouched, which is exactly the class of breakage naive find-and-replace minifiers cause.

Regex detection, division signs and honest ceilings

  • A slash starts a regex only in expression position, judged from the previous significant character plus keywords such as return and typeof, so division after a value stays division, and comment-like sequences inside a character class are kept as regex rather than swallowed as a block comment.
  • This is a pattern-level shrinker, not a compiler: it never renames variables, drops dead code or bundles modules, and empty input is refused instead of returning an empty file.

No code ever leaves the tab, the page issues no requests while minifying, so proprietary sources stay put. What you paste lives and dies inside your own browser session.

Last updated · 2026-09-01

Safe minification versus risky tricks

  • Comments, indentation and line breaks go first — usually a third of raw script size with zero risk.
  • Local variable renaming happens only where scope proves it safe; globals and property names stay untouched so external APIs never break.
  • Even after gzip, minified source stays meaningfully smaller — the two layers remove different kinds of redundancy.

Where the bytes actually go

⚡

Three languages, one tool

HTML, CSS and JS minification share one tabbed page, each with a language-appropriate tokenizer — no hopping between single-purpose sites.

🔒

Strings and regexes survive

The tokenizer understands quoted strings, template literals and regex literals, so minification never breaks "a/ b/c" or the comment-looking text inside them.

🎯

Measured savings

The status bar reports bytes before and after plus the percentage saved, so you can see exactly how much payload each minify removes.

Frequently asked questions

Is it safe for JavaScript?⌄

Yes. The JS minifier tokenizes the input first, distinguishing comments from regex literals and strings, so "/…/" patterns and "//" text inside strings are preserved byte-for-byte while only true comments and cosmetic whitespace are removed.

What about HTML whitespace?⌄

Whitespace between tags is collapsed, but content inside <pre> and <textarea> is preserved because it can be meaningful, and string attributes are kept as-is. The output remains valid HTML that renders identically.

Does this replace a build pipeline?⌄

For one-off tasks, yes. For a whole project you would still use esbuild/terser/CSSNano in CI, but this tool is ideal for copying a snippet, an email template or a single asset into the smallest form.

Related tools

Related tools