Image & SVG
SVG Optimizer
Optimize and sanitize SVG markup locally with safe preview, file loading, and download.
How to use this tool
Paste SVG markup or drop an SVG file.
Choose decimal precision and whether title/description metadata should be removed.
Preview the sanitized SVG, copy the optimized markup, or download the optimized file.
What optimization does
The optimizer removes comments and unsafe SVG content, rounds numeric attributes, strips metadata when requested, and collapses unnecessary whitespace.
Smaller SVG files can load faster and are easier to embed in apps, websites, icon systems, and design tokens.
Why SVG sanitization matters
SVG is XML and can contain scripts, event handlers, remote references, and `foreignObject` content.
Lumio removes risky nodes and attributes before previewing the SVG through a local Blob URL.
If you use SVGs from untrusted sources, review the optimized output before putting it into production.
Examples
Remove unsafe event handlers
Input<svg><rect onclick="alert(1)" width="10.5555" /></svg>Output
<svg><rect width="10.556"/></svg>
Precision tradeoff
Lower precision makes files smaller but can slightly change curves, icon alignment, or detailed illustrations.
FAQ
Can SVG files contain JavaScript?
Yes. SVG can contain script-like behavior through scripts, event handlers, links, and embedded content. This is why sanitization matters.
Will optimization change how my SVG looks?
It can if precision is too low or if the SVG relies on removed unsafe features. Use the preview and choose a higher precision for detailed artwork.
Does the optimizer upload my SVG?
No. Optimization and preview run locally in the browser.
Should I remove title and description tags?
Only remove them if you do not need embedded accessibility or documentation metadata. For public UI icons, meaningful titles can be useful.