CSS Minifier
Compress CSS to its smallest equivalent form by removing comments, collapsing whitespace, and stripping the trailing semicolon before each closing brace.
工具摘要
此工具接收结构化输入,在浏览器中返回确定性输出,无需上传到服务器。
- 工具名称
- CSS Minifier
- 输入意图
- 提供需要转换、校验或分析的原始内容。
- 输出意图
- 获得可直接复制、复用或排错的规范化输出。
- 示例输入
- /* primary button */ .btn { color: red; padding: 8px 16px; }
- 示例输出
- .btn{color:red;padding:8px 16px}
url(...), and quoted values are preserved.工具介绍
Compress CSS to its smallest equivalent form by removing comments, collapsing whitespace, and stripping the trailing semicolon before each closing brace.
工具概览
CSS minification removes characters the browser does not need to render styles correctly. This tool strips /* ... */ comments, collapses runs of whitespace outside of strings, and removes whitespace around structural punctuation ({ } : ; , >). Strings inside url(...) and quoted values are preserved exactly. Byte counts before and after are reported so you can see the savings at a glance. Everything runs in your browser.
使用场景
- Inline critical CSS into <head> with the minimum possible bytes.
- Quickly compress hand-written CSS without spinning up a build pipeline.
- Squeeze additional bytes out of stylesheets already processed by Tailwind or PostCSS.
输入/输出示例
/* primary button */
.btn {
color: red;
padding: 8px 16px;
}.btn{color:red;padding:8px 16px}常见问题
Will minification break url() values or strings?+
Does it support nested CSS or @media blocks?+
Will it rename selectors or shorten colors?+
探索更多工具
在下方的 Developer 分类中发现相关工具。
相关工具
精选可能对你有用的实用工具