Code Minifier

Minify CSS, JavaScript, HTML and JSON

How to minify CSS, JavaScript and HTML

  1. Choose the language: CSS, JavaScript, HTML or JSON.
  2. Paste your code. CSS, HTML and JSON are minified as you type; for JavaScript press Minify.
  3. Check the size saving in the status line, then copy the result or download it as a file.

What each minifier does

CSS: removes comments (keeping /*! licence */ comments), collapses whitespace, drops the last semicolon in each rule, shortens #ffffff to #fff, 0px to 0 and 0.5 to .5. Strings and url() values are left untouched, and spaces inside calc() are kept because they are required.

JavaScript: uses Terser, the minifier behind most modern build tools, loaded on demand. It removes whitespace and comments, simplifies expressions and, if you choose, renames local variables to single letters. Syntax errors are reported with the line and column.

HTML: strips comments and collapses runs of whitespace, while leaving <pre>, <textarea> and <script> content exactly as written. Inline <style> blocks are minified as CSS. Removing all whitespace between tags is optional, because it can remove the visible space between inline elements such as links and buttons.

Is minifying worth it?

Minification typically saves 20–60% before compression and still 5–20% after gzip or Brotli. It speeds up page loads on mobile networks and improves Core Web Vitals. Keep your original source for editing and serve the minified file, ideally as part of a build step.

All minification runs in your browser. Your code is never uploaded.

Will minifying break my code?

Standards-compliant code is safe. JavaScript that relies on function names (for example via Function.name) may behave differently with name shortening; untick that option if so.

Can I un-minify code?

You can reformat it with a beautifier, but comments and original variable names cannot be recovered. Always keep the source.

Is minifying the same as gzip?

No. Minifying removes characters from the source; gzip and Brotli compress the file during transfer. Use both for the smallest downloads.

Made by BufferMint. We also design and build software products for founders. See our services →

Your files and inputs never leave your device; we only count anonymous visits.