Websites from ₹4,999 · Apps from ₹24,999 · 100 free tools

Free tool · Developer tools

HTML, CSS & JS Minifier

Paste HTML, CSS or JavaScript into this free code minifier to strip comments and extra spaces safely, then see the size before and after and how much you saved.

Everything runs in your browser. Nothing you type is sent anywhere, and it is cleared when you close this page.

Free · no sign-up · runs in your browser, nothing is uploaded

Need help fixing it?

Get a free website audit from our team

Our developers check your site's speed, SEO and mobile experience and send you a short list of fixes. No charge, no obligation.

  • Reply on WhatsApp or call, your choice
  • Websites from ₹4,999, apps from ₹24,999

Request free audit

We reply within a few working hours. No spam.

Why use a code minifier?

Every comment, tab and line break in your CSS, HTML and JavaScript is sent to every visitor. Removing them makes files smaller, so pages download faster, especially on slow mobile connections and cheap data plans. This code minifier removes what browsers do not need while keeping the code working exactly as before. It is useful for theme files, landing pages, email templates and small projects that have no build step.

How to use the code minifier

  1. Choose the language: CSS, HTML or JavaScript.
  2. Paste your code, or open a .css, .js or .html file.
  3. Pick the options you want, such as keeping licence comments or also minifying CSS and JavaScript inside an HTML page.
  4. Press Minify and check the size before and after.
  5. Copy the result or download it as a .min file.

What each mode does

CSS: removes comments and extra spaces, and drops the last semicolon in each rule. Text inside quotes and url() values is kept exactly as written, and spaces that matter, such as those inside calc(), are kept.

HTML: removes comments (except old Internet Explorer conditional comments) and collapses spaces between tags. Content inside <pre>, <textarea>, <script> and <style> is left untouched unless you choose to minify the CSS and JavaScript too.

JavaScript: uses a real tokenizer, so strings, template literals and regular expressions are never damaged. Line breaks are kept wherever JavaScript’s automatic semicolon insertion could depend on them. Variable names are not shortened, so the savings are smaller than with build tools such as Terser or esbuild, but the result is safe to use. JSX and TypeScript are not supported.

Tips

  • Always keep your original, readable files. Edit those and minify again; never edit the minified copy.
  • Test the page after replacing a file, especially JavaScript.
  • On WordPress, a caching or optimisation plugin can minify files automatically. This tool is handy for single files, themes, landing pages and code you add by hand.
  • Minifying helps, but large images usually slow a page down much more. Our image converter and compressor can help with those.

Minifying happens in your browser. Your code is never sent to our server and is cleared when you close the page.

FAQ

HTML, CSS & JS Minifier: FAQs

Will minifying break my code?

It should not. The CSS and HTML modes only remove comments and spaces that browsers ignore, and the JavaScript mode uses a full tokenizer and keeps line breaks where they could matter. Still, test the page after you replace a file.

Why is my JavaScript not much smaller?

This tool removes comments and spaces but does not rename variables or rewrite code. Build tools such as Terser or esbuild do that and save more, but need a development setup.

Does it keep licence comments?

Tick "Keep licence comments" and comments that start with /*! are kept, which is the usual way to mark a licence notice.

Can it minify CSS and JavaScript inside an HTML file?

Yes. In HTML mode, tick the options to also minify CSS inside style tags and attributes, and JavaScript inside script tags.

Is my code uploaded anywhere?

No. Everything runs in your browser, and nothing is sent to our server.

More free tools

You might also like

New

Image Colour Picker

Upload or paste a picture into this image colour picker and tap anywhere to get the exact HEX, RGB and HSL code,…

Design tools
New

Merge PDF

Merge PDF files into one document for free. Add your PDFs, put them in order and download a single combined file, without…

PDF tools
New

CSS Gradient Generator

Design linear, radial and conic backgrounds with this CSS gradient generator: drag colour stops, set opacity, start from 16 presets, copy the…

Design tools

See all free tools

Have a project in mind?

Tell us what you want to build. You get ideas, a timeline and a clear quote, free.

Chat on WhatsApp