Free AI Tools

View all 83 →

Code Minifier

Every byte your page sends costs loading time, especially on mobile. Minifying CSS, JavaScript and HTML removes the comments, indentation and line breaks that make code readable for people but mean nothing to browsers. Files often shrink by 20% to 40% before compression, which helps your Core Web Vitals and page speed scores. This free code minifier handles all three languages on one page and shows exactly how many bytes and what percentage you saved. It's deliberately conservative: the goal is code that always works, not the last possible byte. For CSS it strips comments and whitespace, removes unnecessary semicolons, shortens zero units and hex colours where it's safe, and keeps strings, url() values and calc() spacing intact. For JavaScript it removes comments and indentation and collapses blank lines while correctly skipping over strings, template literals and regular expressions. It keeps line breaks, so automatic semicolon insertion can never change how your code behaves, and it never renames variables. For HTML it removes comments (except conditional ones) and collapses whitespace between tags, but leaves <pre>, <textarea>, scripts and styles untouched. For production builds, a bundler with a full minifier like esbuild or Terser goes further. Your code never leaves the browser.

Minify code

–Original
–Minified
–Saved

How to minify

  1. Choose CSS, JavaScript or HTML.
  2. Paste your code; it minifies instantly.
  3. Copy or download the result, and keep your original for editing.

Always

  • Test the minified file before deploying.
  • Enable gzip or Brotli on your server too; it compounds the savings.

FAQ

Will minified code behave the same?

That’s the point of the conservative approach: no renaming, and JavaScript line breaks are kept so semicolon insertion can’t change behaviour.

Why is my JavaScript not as small as with Terser?

Terser also renames variables and rewrites code. Use it in a build pipeline; use this for quick, safe trims.

Does it keep licence comments?

Yes. Comments starting with /*! are preserved.

Is my code uploaded?

No. It runs in your browser.

Related on Botvana

Comments

Contact Botvana

Newsletter

One short email every Friday: the AI news that matters and one tool worth trying.

Botvana
Home About Newsletter
Home Topics Search Newsletter