Minify HTML, CSS, and JavaScript Online

Quickly compress your website code with our free minifier tool. Reduce file size, speed up page loading, and optimize performance without changing functionality

Data to minify:


A minifier makes HTML, CSS and JavaScript files smaller by removing what browsers don't need: comments, line breaks, indentation and other extra whitespace. JavaScript is compressed with Terser, which also shortens local variable names. Paste code, and the tool detects the language, minifies it in your browser and shows how much smaller it is.

How to minify code

  1. Paste HTML, CSS or JavaScript into Data to minify.
  2. Click Minify. The language is detected automatically; in HTML, inline <style> and <script> blocks are minified too.
  3. Check the original size, minified size and saving, then copy the result.

How much does minification help?

Savings depend on how the code was written: heavily commented, indented files shrink the most. Servers usually compress files with gzip or Brotli as well, and compression already removes much of the repeated whitespace, so the transfer-size gain after compression is smaller than the raw saving shown here. For JavaScript, Terser's renaming and dead-code removal give gains that compression can't.

Minification is one of many page-speed fixes. Large images, render-blocking scripts and unused CSS usually matter more for Core Web Vitals.

Before you deploy minified code

  • Keep the original. Minified code is hard to edit. Keep the readable source and minify a copy; the beautifier can re-indent code, but it can't restore comments or original variable names.
  • Test the result. JavaScript that relies on a missing semicolon or on function names (for example via Function.name) can behave differently after minification.
  • Automate it for real projects. Build tools such as Vite, webpack, esbuild or Terser's command line minify on every build. This tool is best for one-off snippets and quick checks.

Frequently asked questions

Is minification the same as compression?

No. Minification rewrites the code itself to be shorter. Compression (gzip or Brotli) is applied by the web server to whatever file it sends. They work together: minify the file, then let the server compress it.

Does minifying HTML, CSS and JavaScript help SEO?

Indirectly. Smaller files load faster, and page experience is one of many ranking signals. The effect of minification alone is usually small compared with images and render-blocking resources.

Is my code uploaded?

No. Minification runs in your browser; the code isn't sent to PagesTest.

How do I minify JSON?

Use the JSON formatter and click Minify. It also validates the JSON at the same time.