AZ Tools

HTML / CSS / JS Minifier

Developer

Paste source code, pick HTML / CSS / JS, and the tool removes redundant whitespace and (optionally) comments, returning a single-line minified version with the byte size before and after plus the percentage saved. Pure regex-based — fast, fully offline, no library required. Best for small inline snippets and final-mile size trims; for build pipelines, use a dedicated minifier like terser or esbuild.

Original
234 B
Minified
161 B
Saved
31.2%
Minified
<!doctype html><html lang="en"><head><title>Sample Page</title></head><body><h1>Hello, world!</h1><p> This is a paragraph with multiple lines. </p></body></html>

How to use

  1. Paste your source code.
  2. Pick the language (HTML / CSS / JS).
  3. Toggle whether to strip comments.
  4. Copy the minified output.

Frequently asked questions

Is this safe for production?
For small CSS or HTML, yes — the rules are conservative. For JavaScript, prefer a tool like terser or esbuild in your build, since this tool doesn't rename variables, fold constants, or do dead-code elimination.
Why isn't my JS more compressed?
True JS compression needs an AST-based tool. This minifier removes whitespace and comments only — that's already a big win for hand-written snippets but won't match terser's output.
Will it break HTML inside <pre> or <textarea>?
It can — whitespace there is significant. Avoid running the minifier on HTML containing those elements, or replace their contents with a placeholder first.
Are CSS comments important?
Sometimes — license headers in /*! comments by convention are kept by professional minifiers. This tool removes all comments if 'strip comments' is on; for license-preserving output, set it off.

Related tools