⚡ Curated dev resources & dealsSponsored
DevToolBayFree Developer Tools

CSS 格式化压缩

CSS 美化(统一缩进、注释可保留)与压缩(大小对比):大括号平衡检查,属性顺序原样保留。

Mode
Indent
Blank line between rules

How it works

The tool first strips comments (respecting strings), then tokenizes by brace depth: at-rules (@media), selectors and declarations are re-emitted with chosen indentation; minify mode collapses runs of whitespace, removes final semicolons and shortens nothing else (no dangerous rewrites like #fff→#fff optimizations or vendor-prefix removal). Brace balance is checked — mismatched braces are reported with the depth found.

如何使用CSS 格式化压缩

粘贴样式表,在 Format 与 Minify 间切换。格式化按两空格缩进重排,注释、自定义属性与 calc() 原样保留;压缩剔除注释与空白,字符串、url() 与 data URI 逐字节保留。

每次运行后看一眼大小对比——手写样式通常缩水两到四成。编辑源保格式化版,发版交压缩版,这个往返每次保存都安全。

相关工具