Code Minifier

Minify CSS, HTML and JavaScript right in your browser. Remove comments and whitespace, and see the before/after size and reduction rate.

Last updated: 2026/10/16 Developer Feedback & bug reports
Input Code
Minified Output
0 Before
0 After
0% Reduction

How to Use

1

Pick a tab and paste code

Switch between the CSS / HTML / JavaScript tabs and paste the code you want to minify into the input field.

2

Click "Minify"

Comments and whitespace are removed, and the before/after size and reduction rate are displayed.

3

Copy the result

Use the "Copy" button to grab the minified code and paste it into your production file.

What is Code Minification?

Minification removes unnecessary comments, whitespace and line breaks from code to shrink the file size without changing how it behaves. Smaller files load faster, improving page rendering and Core Web Vitals. This tool uses a safe in-house minifier for CSS and HTML that protects string and comment regions, and the popular terser library for JavaScript. All processing happens entirely in your browser, so your code is never sent to any server.

Features

  • CSS / HTML / JS SupportSwitch tabs to minify three kinds of code, each with its own optimized routine.
  • Safe Minify LogicCSS/HTML protect strings and comment regions before compressing; JS is reliably minified with terser.
  • Reduction at a GlanceSee the before/after file size and reduction rate so the effect is obvious instantly.
  • Fully Browser-BasedEverything runs in your browser. Your code is never sent to a server—privacy protected.

Use Cases

  • Shrink CSS/JS before going live to speed up rendering
  • Address the "Minify" warnings in PageSpeed Insights
  • Reduce file size of HTML emails and landing pages
  • Manual minify for small sites without a build pipeline
  • Check the size of snippets and inline code

FAQ

Is the code minifier free to use?
Yes, it is completely free. No registration or installation is required—just open it in your browser and start using it.
Is my code sent to a server?
No. All minification happens entirely in your browser. Your code is never sent to or stored on any server, so you can safely minify private code.
Does minifying change how my code behaves?
Minification mainly removes comments and whitespace, so behavior generally stays the same. However, a few edge cases—such as CSS calc(), unusual syntax, or layouts that depend on whitespace between inline HTML elements—can render differently. Always test before deploying to production.
How is JavaScript minified?
It uses the popular "terser" library, which removes comments and whitespace and also shortens variable names. If the library cannot be loaded, it falls back to a simplified minify (comment/whitespace removal only) and tells you so.
Could strings inside CSS/HTML comments get broken?
No. String literals and comment regions are stashed away before whitespace is compressed and then restored, using a safe approach. Symbols inside quotes or braces inside comments are never compressed by mistake.
Can I use it on my smartphone?
Yes, it works on all devices including smartphones, tablets, and PCs.