CSS 压缩与美化
UpBox优盒工具箱,免费在线 CSS 压缩与美化工具,去除多余空格与注释,或把压缩代码格式化成分行结构,保留字符串与 calc 运算。
无需注册 · 数据不上传No sign-up · nothing uploaded
源 CSSSource CSS
原始大小—
输出大小—
输出占比—
处理结果Result
粘贴 CSS 后自动处理
字符串、url() 与 calc() 内的空格会被保留
本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器
工具介绍
CSS 压缩会去掉注释、换行与多余空格,去掉规则末尾多余分号,把文件压到最小;美化则把压缩代码展开成缩进清晰、每条声明独占一行的结构。 Minifying strips comments, line breaks and redundant spaces, and drops trailing semicolons; beautifying expands compressed code into indented rules with one declaration per line.
处理过程会保护字符串、url() 与 calc() 内部空格,避免把 data URI 或数学表达式改坏;可保留注释,适合需要许可证头的第三方样式。 String contents, url() and calc() spacing are protected so data URIs and math expressions stay intact; comments can be kept for license headers.
- 一键压缩One-click minify
- 格式化排版Readable formatting
- 注释保留Comment preservation
- 字符串保护String-safe processing
- 本地处理Local processing
使用说明
- 粘贴 CSS 代码。Paste your CSS.
- 选择“压缩”或“美化”。Pick minify or beautify.
- 需要许可证头时勾选“保留注释”。Tick keep comments for license headers.
- 复制结果或下载 .css 文件。Copy the result or download a .css file.
常见问题
压缩会改变样式效果吗?Does minifying change rendering?
不会。只调整空白与注释,字符串和 calc() 内的空格保持原样。No. Only whitespace and comments change; strings and calc() spacing are preserved.
支持 SCSS / Less 吗?Does it support SCSS or Less?
不支持。当前只处理标准 CSS,预处理器语法请先编译。No — standard CSS only; compile preprocessor syntax first.
美化后的分号是必需的吗?Are the added semicolons required?
不是必需,但保留分号更利于后续 diff 与手工编辑。Not required, but they make diffs and manual edits easier.
代码会上传吗?Is code uploaded?
不会,处理完全在浏览器本地完成。No, everything runs locally.