Smaller files, same behaviour.

Comments, indentation and blank lines make code pleasant to edit, but browsers download every one of those bytes. Minifying removes them before the code goes live.

This minifier is careful on purpose: it removes only comments and spacing that cannot matter, and never renames anything or rewrites logic. Paste a stylesheet, a script or a page and see how much you save.

Runs in your browser. Nothing is uploaded.

More speed tools · All 54 tools

How to use it

  1. Choose the Language: CSS, JavaScript or HTML.
  2. Paste your code into Input.
  3. For HTML, keep the option to also minify inline style and script blocks ticked to shrink embedded code too.
  4. Press Minify and read the size saving in the status line.
  5. Copy or Download the Output, test it in a browser, and keep your original file for future edits.

Good to know

What gets removed

  • CSS: comments, line breaks and spaces around { } ; : , > ~, and the last semicolon before }. Text inside quotes is left alone.
  • JavaScript: comments and spacing between tokens. Strings, template literals and regular expressions are copied exactly. A line break is kept where removing it could change how the code runs, because JavaScript inserts semicolons automatically at some line ends.
  • HTML: comments and runs of whitespace. Spaces between inline elements shrink to one space rather than vanishing, so words do not run together. The contents of <pre> and <textarea> and quoted attribute values stay exactly as written. Conditional comments are kept. JSON in a <script type="application/json"> or JSON-LD block is compacted.

Comments that start with /*! are kept in CSS and JavaScript, the usual way to protect licence notices.

A worked example

The sample stylesheet in the input box is 146 bytes:

/* Card styles */
.card {
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 10%);
}

.card > h3 {
  margin: 0 0 8px;
}

Minified, it becomes 101 bytes, about 31% smaller:

.card{padding:24px;border-radius:12px;box-shadow:0 4px 16px rgb(0 0 0 / 10%)}.card>h3{margin:0 0 8px}

The saving is worked out as (1 − minified ÷ original) × 100, using UTF-8 byte sizes.

How it compares with build tools

Tools such as Terser, esbuild and cssnano go further: they shorten variable names, drop unused code and merge rules, often saving much more. This tool trades that extra saving for predictability, which suits a quick fix, a single file or a site without a build step.

Minify and compress

Minifying and server compression work together. Gzip or Brotli compression on your web server usually shrinks text files far more than minifying alone, and minified files compress slightly better still. Turn both on where you can.

Limits

The JavaScript minifier reads code token by token rather than fully parsing it, so unusual syntax can trip it. Always load the minified file in a browser and check the console before you publish it.

Questions.

Will minifying break my code?

It should not, because only comments and safe spacing are removed. Still, test the result in a browser before publishing, especially for JavaScript with unusual syntax.

Does it rename variables?

No. Names and logic stay exactly as you wrote them. For renaming and dead-code removal, use a build tool such as Terser or esbuild.

Are licence comments kept?

Yes, any comment starting with /*! is kept in CSS and JavaScript. All other comments are removed, so do not rely on them for anything the code needs.

Can I turn minified code back into readable code?

Spacing can be restored by a formatter, but removed comments are gone for good. Keep your original source and minify a copy.

Is it worth minifying if my server uses gzip?

Yes, a little. Compression does most of the work, but minified files are smaller before and after compression, and comments are no longer public.

Why is some spacing left in my HTML?

A single space between inline elements, such as two links in a sentence, is visible on the page. Removing it would join words together, so the tool keeps one.