使用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請求。