AioGalaxy WebTools
Code minifier

Free Online HTML, CSS & JS Code Minifier

Paste CSS, JavaScript or HTML and remove comments and extra whitespace to make it smaller. It is a simple tool for quick jobs, and your code stays in your browser.

HTML, CSS & JS Support Shows bytes saved Minify & basic Beautify Runs in your browser
Source Code
Minified Output 0% Saved
Original Size: 0 B Minified Size: 0 B Bytes Saved: 0 B

How to Use Code Minifier?

Step 01

Select Code Type

Choose your target language tab: CSS, JavaScript, or HTML.

Step 02

Paste Source Code

Paste your raw code into the left editor or click "Sample" to test.

Step 03

Minify or Download

The output updates as you type. Copy it, or download it as a .min file.

Complete Guide

What minifying does and when to use it

Smaller files download faster, and tools such as Google Lighthouse suggest minifying CSS and JavaScript. Minifying removes parts of the code that people read but browsers do not need.

What this tool removes

  • Comments: /* ... */ blocks in CSS and JavaScript, // comments in JavaScript, and <!-- ... --> comments in HTML.
  • Extra whitespace: repeated spaces, tabs, line breaks and indentation, and the spaces around symbols such as braces and colons.
  • Last semicolon in CSS: the semicolon before a closing brace.

Limits to know about

This is a simple pattern-based minifier. It does not rename variables or rewrite code, and it does not understand JavaScript fully. A // inside a string, such as a URL, can be mistaken for a comment, and whitespace inside HTML <pre> blocks or scripts is also collapsed. Always test the result before using it on a live site. For production JavaScript, a build tool such as Terser or esbuild is the safer choice.

Frequently Asked Questions

What is code minification and how does it improve website performance?

Minification removes characters a browser does not need, such as comments, extra spaces, tabs and line breaks, from HTML, CSS and JavaScript. Smaller files download faster, which helps page speed.

Does minifying JavaScript or CSS break code logic?

It can. This tool uses simple pattern matching, not a full parser. In JavaScript it treats everything after // as a comment, so a string such as "https://example.com" can be cut off, and code that relies on line breaks instead of semicolons can break. CSS and HTML are usually safe, but always test the output. For production JavaScript, use a build tool such as Terser or esbuild.

Can I reverse minified code back to a readable formatted state?

Partly. The Beautify button adds line breaks and indentation to CSS and HTML. It does not format JavaScript, and comments that were removed by minifying cannot be brought back.

Is my source code uploaded or stored on your servers?

No. The minifying happens in your browser, so your code is not sent to our server.

What is the average file size reduction percentage achieved by minification?

It depends on how many comments and how much indentation the file has. Heavily commented, well-indented files shrink the most, while already compact files barely change. The tool shows the exact bytes saved for your code.

Explore Related Developer Tools

Popular