使用SVGO压缩SVG文件。删除元数据、注释和冗余代码 — 完全在浏览器中。
Optimize up to 50 SVG files at once and download as a ZIP.
| 插件 | 功能 |
|---|---|
| removeComments | Removes XML and SVG comments |
| removeMetadata | Removes <metadata> blocks added by design tools |
| cleanupAttrs | Cleans up attribute formatting and whitespace |
| minifyStyles | Minifies inline CSS style attributes |
| cleanupIds | Removes unused IDs and shortens referenced ones |
| convertColors | Converts colors to shorter hex notation |
| convertPathData | Optimises path data commands and coordinates |
| mergePaths | Merges adjacent paths with identical styles |
| collapseGroups | Collapses unnecessary group elements |
| removeUselessDefs | Removes <defs> with no referenced elements |
SVG优化从SVG文件中删除不必要的内容:编辑器元数据、注释、隐藏元素、默认属性值和冗余空白。它还合并路径、将形状转换为更短的等效项,并对小数坐标进行四舍五入。结果是一个更小、更干净的SVG,渲染效果相同。
节省量因SVG的创建方式而异。从Illustrator或Inkscape导出:减少50-80%。手动优化的SVG:10-30%。来自Figma等设计工具的SVG已经比较干净:20-50%。此工具显示精确的字节节省量。
使用默认设置,优化是无损的 — 优化后的SVG渲染效果与原始SVG相同。删除viewBox或合并样式等激进选项可能会影响缩放或外部样式。此工具使用安全的默认SVGO预设。
可以。优化后的内联SVG可以直接粘贴到HTML中。对于img标签或CSS背景,请保存为.svg文件。对于非常小的图标,考虑转换为数据URI(例如url("data:image/svg+xml,..."))以实现零HTTP请求。