Code Minifier

Minify HTML, CSS, or JavaScript. Strips comments and collapses whitespace.

What is code minification?

Minification is the process of removing unnecessary characters from source code without changing its functionality. This includes stripping comments, collapsing whitespace, and removing redundant formatting. The result is a smaller file that loads faster over the network, which directly improves page speed and user experience.

How does this tool work?

This minifier runs entirely in your browser. No code is sent to any server. Choose a language tab - HTML, CSS, or JavaScript - paste your code, and press Minify. For HTML, it removes comments and collapses runs of whitespace into single spaces. For CSS, it strips block comments, removes unnecessary semicolons before closing braces, and collapses whitespace. For JavaScript, it removes both single-line and multi-line comments, then collapses whitespace while taking care not to break string literals.

Why minify your code?

Smaller files transfer faster. On slow connections or mobile networks, every kilobyte counts. Minification typically reduces file size by 10 to 60 per cent depending on how the original code is formatted. It is a standard step in most deployment workflows and is recommended by Google PageSpeed Insights and other performance auditing tools. For production websites, minified assets contribute to better Core Web Vitals scores, lower bandwidth costs, and quicker time-to-interactive. Combined with compression (gzip or Brotli), minification ensures your users receive the smallest possible payload. This tool gives you a quick way to minify snippets without installing build tools or configuring a bundler.

ectoplasma.org ยท free tools