Optimize SVG Icons for Faster Sites
A practical SVG icon optimization workflow with SVGO settings, common fixes, and a calculator to estimate bandwidth savings.
On this page
If your icons are already SVG, optimization is usually the fastest performance win you can ship this week.
SVG is text-based, so every extra path, metadata block, and decimal point increases transfer size.1
Start here
Use this calculator to estimate impact before you optimize.
Quick workflow
- Export clean SVGs from your design tool.
- Run SVGO in your build or pre-commit pipeline.2
- Keep
viewBoxintact so scaling stays correct.3 - Test the icon at 16px, 20px, 24px, and 32px.
- Re-check color inheritance with
currentColor.
SVGO config
The settings below are a safe default. For a plugin-by-plugin config that squeezes out more bytes, see SVGO configuration for maximum compression.
{
"multipass": true,
"plugins": [
"preset-default",
"removeDimensions",
{
"name": "convertPathData",
"params": { "floatPrecision": 2 }
}
]
}
floatPrecision: 2 is a safe baseline for most UI icons. Lower values can distort tiny details.
Common mistakes
- Removing
viewBoxand breaking responsive scaling. - Over-optimizing path precision until strokes look uneven.
- Exporting presentation-heavy SVG from design tools and skipping cleanup.
- Mixing
fill-based andstroke-based icon sets in one UI surface.
Example icon
lucide:zap•56px<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.914 4a1.5 1.5 0 0 0-2.474-1.561l-9 9A1.5 1.5 0 0 0 5.5 14h4.002a.5.5 0 0 1 .471.666L8.086 20a1.5 1.5 0 0 0 2.475 1.56l9-9A1.5 1.5 0 0 0 18.5 10h-3.997a.5.5 0 0 1-.472-.667z"/></svg>Video walkthrough
Use with AllSVGIcons
If you want to optimize fast without local setup, use the built-in tool: /svg-optimizer/.
Advanced optimization workflow
If you optimize icons at team scale, move beyond one-off manual cleanup.
- Define one shared SVGO config in repo.
- Run optimization in pre-commit or CI.
- Keep original source icons in a separate folder for design edits.
- Compare visual output at target sizes before merge.
This avoids inconsistent optimization settings between contributors.
When optimization can hurt
Aggressive path simplification can deform brand marks or tiny detail icons. If you notice visual artifacts:
- raise float precision
- disable risky plugins for that file category
- keep a visual diff check in PR review
Final shipping checklist
- optimized icon still matches intended shape
viewBoxpreserved- size reduction is meaningful
- no accessibility regressions from cleanup
Team policy example
A practical policy many teams use:
- all new SVG assets must pass optimizer pipeline
- complex logos can use separate profile with safer precision
- critical UI icons are reviewed at 16px and 24px before merge
This keeps performance gains consistent without compromising visual quality.
Final note
Optimization is most effective when automated and repeatable. Treat SVG cleanup as part of build quality, not an occasional manual task.
Consistent optimization also improves cache efficiency when icons are reused across pages.
Additional source references: 4.
Sources
Footnotes
Related posts