CSS Minifier

Compress CSS to reduce file size and improve page load speed. Removes comments, whitespace, and redundant rules — 100% in your browser.

CSS Input

Minified Output

100% Private

All processing happens in your browser. Your CSS is never sent to any server — paste confidently.

Minify & Beautify

缩小以减少文件大小,或美化以将压缩的CSS扩展回可读格式以进行调试。

Faster Page Load

缩小CSS可减少渲染阻塞时间,提高First Contentful Paint (FCP)和整体页面速度分数。

What is CSS Minification?

CSS minification removes all unnecessary characters from a CSS stylesheet without affecting how the page looks. This includes whitespace, line breaks, comments, and the last semicolon before a closing brace. The output is a single-line stylesheet that is functionally identical to the original but significantly smaller — typically 20–40% smaller before compression.

CSS是一种渲染阻塞资源。浏览器必须下载并解析所有CSS才能渲染页面,这意味着大型或未缩小的CSS文件会延迟First Contentful Paint (FCP)和Largest Contentful Paint (LCP)。Google PageSpeed Insights将未压缩的CSS标记为“压缩CSS”机会,而Lighthouse等工具会在性能审计中惩罚渲染阻止样式表。

此工具使用自定义缩小算法在您的浏览器中完全处理CSS。它删除注释、折叠空格、删除CSS语法字符( {,},:,;,, )周围的空格,并在关闭大括号之前删除尾随分号。Beautify函数反转此过程,重新缩进规则以实现可读性—当您从第三方收到压缩的CSS并需要读取或修改它时非常有用。

When to Minify CSS

在以下情况下压缩CSS :

  • ✓ 将任何网站部署到生产环境
  • ✓ PageSpeed Insights显示“缩小CSS”机会
  • ✓ 为WordPress、Shopify或Webflow构建自定义主题
  • ✓ 减少渲染阻塞时间以提高FCP分数
  • ✓ Compressing large CSS frameworks before use
  • ✓ 优化电子邮件模板样式表

Beautify CSS when:

  • ✓ Debugging styles in a production stylesheet
  • ✓ 检查第三方CSS库
  • ✓ 从浏览器DevTools读取压缩的CSS
  • ✓ 修改已交付的CSS主题已压缩
  • ✓ 自动生成的样式表的代码审查

常见问题