About this tool
Shrink code by removing comments and unnecessary whitespace. Useful for quick snippets, inline scripts and email templates.
How to use the Code Minifier (CSS, JS, HTML, JSON)
- Enter the language and code.
- The result appears in the output box as you type.
- Copy the output or download it as a file.
How it works
CSS and HTML minifiers strip comments and collapse whitespace around syntax characters. The JavaScript minifier tokenises strings, template literals and regular expressions so they are never altered, and keeps line breaks where automatic semicolon insertion might depend on them.
Frequently asked questions
Does it rename variables?
No. For maximum compression in production, use a build tool such as esbuild or Terser.