Skip to content
Tezmy Tools

HTML, CSS & JS Minifier

Make HTML, CSS and JavaScript smaller by removing what browsers don't need

Runs in your browser; your code is never uploaded. Keep your original files: minified code is hard to edit.

Runs in your browser. Nothing is uploaded.

About the HTML, CSS & JS Minifier

Tezmy's HTML, CSS and JS Minifier makes your code smaller so pages load faster. Pick HTML, CSS or JavaScript and paste your code. The minified version appears next to it with the size before and after. For JavaScript it uses Terser, the minifier used by most modern build tools, which removes comments and spaces, shortens local variable names and simplifies code while keeping it working; syntax errors are shown with their line and column. The CSS minifier removes comments, spaces and empty rules while leaving strings, calc() maths and selectors intact. The HTML minifier removes comments and collapses whitespace, leaves pre, textarea and script blocks untouched and can minify the CSS inside the page. It all runs in your browser.

Updated September 2026

How to use the HTML, CSS & JS Minifier

  1. 1Choose HTML, CSS or JavaScript.
  2. 2Paste your code into the left box (an example is there to try).
  3. 3Adjust the options, such as removing comments or shortening variable names.
  4. 4Copy or download the minified code, and keep your original for editing.

When to minify

  • Before publishing a small website or landing page without a build system.
  • When a page speed test says “Minify CSS” or “Minify JavaScript”.
  • For code snippets you embed on other sites, such as widgets or tracking tags.
  • To check how much a file could shrink before setting up a build tool.

Good habits

  • Keep the readable source file and minify a copy; name it like style.min.css.
  • Test the page with the minified files before replacing the live ones.
  • Turn on Gzip or Brotli compression on your server as well.
  • For big projects, use a build tool (Vite, webpack, esbuild) that minifies automatically.

Related tools

Working with data formats? The JSON Formatter and XML Formatter can both prettify or minify, and the Diff Checker shows exactly what changed between two versions of a file. For images, which are often the largest files on a page, use Compress Image.

Features

  • HTML, CSS and JavaScript
  • JavaScript minified with Terser (compress + shorter names)
  • Syntax errors with line and column
  • Safe CSS minifying (strings and calc() kept)
  • HTML keeps pre, textarea and script content
  • Size before and after
  • Copy or download, nothing uploaded

Frequently asked questions

What does minifying code do?

It removes everything the browser doesn't need, such as comments, indentation, line breaks and extra spaces, and for JavaScript also shortens variable names. The code works the same but downloads faster, which helps page speed and Core Web Vitals.

How much smaller will my files get?

Typically 10–25% for HTML, 15–30% for CSS and 30–60% for JavaScript, depending on how many comments and spaces the original has. The tool shows the exact saving. Gzip or Brotli compression on your server shrinks files further on top of that.

Can minifying break my code?

JavaScript is minified by Terser, which understands the code and keeps it working; if your code has a syntax error, it tells you instead. The CSS and HTML minifiers only make safe whitespace and comment changes. Still, test the minified version before publishing, and never edit minified files directly.

Does the HTML minifier minify JavaScript inside the page?

No. Scripts inside <script> tags are left exactly as they are, to avoid breaking them. Minify your JavaScript separately with the JavaScript option, or use a build tool that handles both.

Why keep “/*! … */” comments?

Comments starting with /*! usually contain a licence notice that open-source licences ask you to keep. The CSS minifier keeps them, and the JavaScript minifier keeps them while “Remove comments” is on.

Is my code uploaded?

No. All minifying happens in your browser, so private code and client work stay on your device. Terser is loaded once when you first minify JavaScript.

Related tools