TOOLDENDEVELOPERON-DEVICE
SVG Optimizer
Paste SVG code or upload a file, strip the cruft, minify the numbers and watch the file size shrink, all in your browser.
HOW TO USE
- 1Paste SVG code into the box, or click "Upload .svg file" to load one from your device.
- 2Click Optimize. The tool strips XML declarations, doctypes and comments, collapses whitespace and minifies numbers like 50.00 to 50 and 0.5 to .5.
- 3Read the size stats in the results: original size, optimized size and the percentage saved.
- 4Copy the optimized code or download it as optimized.svg.
EXAMPLE
INPUT
An SVG with comments, an XML declaration, width="100.00" and coordinates like 50.00
OUTPUT
The same SVG with comments and declaration removed, width="100" and coordinates like 50, typically 10 to 30% smaller
FAQ
Is the optimization safe?
The tool only removes things the SVG spec marks as optional: XML declarations, doctypes, comments, redundant whitespace, empty attributes and trailing zeros in numbers. The rendered image is identical.
What if my SVG uses xml:space="preserve"?
Whitespace inside such elements is meaningful, so the optimizer detects xml:space="preserve" and skips whitespace collapsing to keep text layout intact.
Why does the size stay the same for some files?
Files written by good editors are already clean — there is little to strip. The biggest wins come from files with comments, verbose coordinate precision or editor boilerplate.
Can I upload any file type?
Only .svg files are accepted. Compressed or binary variants are not supported, paste the code directly instead.
Is my data sent anywhere?
No. Everything runs in your browser, your SVG never leaves your device.