Skip to content

Developer & Security

Minify HTML, CSS & JavaScript

Shrink your code before you publish it. Paste HTML, CSS or JavaScript and see the result along with the percentage of size saved.

Free · no sign-up · runs in your browser · updated

Use Minify HTML, CSS & JS

How to use Minify HTML, CSS & JS

  1. Choose a language: HTML, CSS or JavaScript.

  2. Paste your code and click Minify.

  3. Copy or download the result, and check how much size you saved.

Why does minifying matter?

Smaller files download faster, especially on mobile networks, and that helps page-speed scores that affect user experience and SEO. The gain is largest for big CSS and JavaScript files. Servers that enable gzip or Brotli compression add further savings, and minifying and compression can be used together.

Is it safe?

The CSS and HTML minifiers here are deliberately conservative: they only remove comments and whitespace that don’t affect how the page looks, and they leave text content, pre blocks, textareas, scripts and strings untouched. JavaScript is processed by Terser with compress and mangle options you can turn off. Always test the result before you publish it, and keep the original code as your source, because minified code is hard to read.

Questions about Minify HTML, CSS & JS

What is the difference between minifying and gzip compression?

Minifying changes the contents of the file by removing characters that aren’t needed. Gzip or Brotli compresses the file when the server sends it and the browser unpacks it. The two complement each other.

Does minifying change how my code works?

It shouldn’t. For JavaScript, the mangle option shortens local variable names, which is safe unless your code depends on function or variable names themselves (for example through eval).

Why did minifying my JavaScript fail?

There is usually a syntax error. The error message shows the line and column. Modern JavaScript syntax (ES2022) is supported, but JSX and TypeScript must be compiled first.

Is my code sent to a server?

No. The whole process runs in your browser. The Terser library for JavaScript is only downloaded when you click Minify, and it runs locally.

How do I restore minified code?

Use a formatter (pretty printer) to lay it out again, but the original comments and variable names can’t be recovered. Always keep the source version.

Need more than tools?

We build websites, apps, and custom systems for your business.

These tools are only a small part of what Tipamedia can build. Tell us what you need and we will help you work out the next step.