// how-to guide
How to Minify CSS Online
Compress CSS by removing whitespace, comments, and unnecessary characters to reduce file size.
- 1
Paste your CSS
Copy your CSS stylesheet or code snippet and paste it into the input editor.
- 2
View minified output
The tool strips whitespace, comments, and redundant characters while preserving all style rules.
- 3
Check the size reduction
See the original and minified file sizes to understand the compression ratio.
- 4
Copy the minified CSS
Copy the compressed output for use in production builds or inline styles.
Every kilobyte of CSS your browser downloads adds to page load time. Minification strips out everything the browser does not need — whitespace, comments, redundant semicolons — without changing how your styles render. When you need to quickly minify a snippet without configuring a build tool, the CSS Minifier gets it done in seconds.
Why minification matters
Unminified CSS includes indentation, line breaks, comments, and sometimes redundant rules — all of which make the code readable for developers but add unnecessary bytes for browsers. On a typical stylesheet, minification reduces file size by 15-30%. Combined with gzip or Brotli compression on the server, the savings compound further.
For production websites, minified CSS directly impacts Core Web Vitals. Smaller CSS files mean faster First Contentful Paint and less render-blocking time. On mobile connections especially, every kilobyte counts.
Build tools vs. online minification
In a production workflow, CSS minification should be automated as part of your build process using tools like cssnano (PostCSS), esbuild, lightningcss, or the built-in minification in bundlers like Vite and webpack. These tools run on every build and ensure nothing ships unminified.
So when would you use an online minifier? Common scenarios include:
- Minifying a CSS snippet for an email template where you do not have a build pipeline.
- Quick one-off minification for inline styles in a CMS or landing page builder.
- Checking how much size reduction minification would give you before setting up tooling.
- Working on a legacy project that does not have a modern build system.
Tips and best practices
- Keep source maps in development. Minified CSS is unreadable. If you are debugging in the browser, make sure your build tool generates source maps that map minified selectors back to the original source.
- Do not minify CSS that you will edit again. Minified code is a build artifact. Always keep the unminified source and regenerate the minified version from it.
- Test after minification. Aggressive minifiers can occasionally break CSS — for example, by removing quotes around font family names or collapsing shorthand properties incorrectly. Spot-check your pages after minifying.
- Combine with Brotli or gzip. Minification and compression are complementary. Minification removes syntactic redundancy; compression removes statistical redundancy. Use both for the best results.
Common issues
- Styles look different after minification: This is rare but can happen if the minifier reorders properties or merges conflicting shorthand declarations. Check for specificity issues or order-dependent rules (like overlapping
marginandmargin-topdeclarations). @charsetdeclarations removed: Some minifiers strip the@charsetrule. If your CSS contains non-ASCII characters, make sure the server sends the correctContent-Type: text/css; charset=utf-8header.- Comments you wanted to keep: License comments or annotations like
/*! ... */are usually preserved by minifiers, but check your tool’s configuration. Use the/*!prefix to mark comments as important.
#Try It Now
Use the CSS Minifier tool directly — no sign-up needed. Runs entirely in your browser.
Open CSS Minifier →