Skip to content

Code Minifier

Paste your HTML, CSS, or JavaScript and get a minified version instantly. See exact size savings. Free, 100% client-side — no data sent anywhere.

Enter code above and click Minify.

What is code minification?

Code minification removes unnecessary characters from source code — whitespace, comments, line breaks, and optional delimiters — without changing the code's behavior. The result is a smaller file that downloads faster over the network. Minification is a standard step in every modern front-end build pipeline and is recommended by Google's Web Performance guidelines for HTML, CSS, and JavaScript.

HTML minification

HTML minification removes HTML comments (<!-- ... -->) and collapses whitespace between tags. Browsers ignore extra whitespace in HTML, so removing it has no visual effect but reduces file size. Typical HTML minification savings range from 10–25% depending on formatting style and comment density. Inline <style> and <script> blocks benefit from their own language-specific minification as well.

CSS minification

CSS minification removes comments (/* ... */), collapses whitespace, and removes spaces around {, }, :, ;, and ,. It also removes the last semicolon before }, which CSS parsers allow to be omitted. Well-commented CSS files typically see 20–40% size reduction. For production, tools like cssnano and Lightning CSS go further by merging duplicate rules, shortening colors (#ffffff#fff), and removing redundant prefixes.

JavaScript minification

This tool performs conservative JavaScript minification: it removes single-line comments (// ...), multi-line comments (/* ... */), and collapses whitespace. This is safe and fast, but not a full optimizer — it does not rename variables, tree-shake unused exports, or remove dead code. For production builds, use dedicated tools: Terser (the standard for Webpack/Vite), esbuild (extremely fast, Go-based), or SWC (Rust-based, used by Next.js). These tools achieve 40–70% size reduction by combining minification with variable mangling.

Privacy

All processing runs 100% in your browser. No data is sent to a server.