SVG Optimizer: Clean and Shrink SVG Without Changing the Look
Remove what browsers ignore and shorten values, with before and after previews to prove nothing changed.
SVG Optimizer tool
1Add your SVG
2Adjust the options
3Preview and download
Input and output codeView, edit and copy the code
Under the hood
How SVG Optimizer works
An SVG optimizer cleans an SVG of everything a browser does not need, shrinking the file while keeping the artwork identical. This one defaults to 3-decimal precision, which is safe for nearly all graphics.
Parse and measure
The SVG is read and its size is recorded so each step’s saving can be calculated exactly.
String length · bytes- BeforeAfter
Remove what browsers ignore
The XML declaration, DOCTYPE, metadata, editor attributes and comments are stripped, along with empty defs.
Regex passes - →→→
Shorten the values
Hex colors such as #ffffff become #fff, rgb() values become hex, and numbers are rounded to 3 decimals.
Color shortening · precision 3 Collapse whitespace and report
Whitespace between tags is removed, and a chart shows where every saved byte came from.
Whitespace · gzip estimate
Why this optimizer is the safe default
- 3-decimal precision
- Three decimals keep geometry accurate for almost all artwork while still shortening long numbers.
- Titles kept
- The title and description are kept by default so accessibility is not harmed.
- Visible proof
- Original and optimized previews sit side by side so you can see they match.
Step by step
SVG Optimizer process
Four steps optimize an SVG. The default settings are safe, so you can often just download the result.
Add your SVG
Drop a file, paste code or press the sample button.
Tip: Editor exports shrink the most.
Compare the previews
Look at the Original and Optimized previews. They should look identical.
Tip: If they differ, raise precision.
Adjust the options
Toggle comments, metadata, color shortening and whitespace, and set precision from 0 to off.
Tip: The savings chart updates with every change.
BeforeAfterDownload the optimized SVG
Press Download to save the cleaned file.
Tip: Rendered locally.
Reference
SVG Optimizer settings / conversion chart
The table lists optimization options and their safety. The chart shows the typical contribution of each.
Typical contribution to the savings (editor-exported SVG)
At a glance
- Converts best: Editor data and metadata.
- Needs the most care: Color shortening.
Guide: the exact split for your file is shown in the chart.
| Option | What it removes or changes | Visual risk |
|---|---|---|
| Strip metadata and editor data | XML declaration, DOCTYPE, metadata, editor attributes | None |
| Remove comments | HTML-style comments | None |
| Shorten colors | #aabbcc to #abc, rgb() to hex | None |
| Number precision | Extra decimals in coordinates | Low at 2–3 decimals |
| Collapse whitespace | Spaces and line breaks between tags | None |
| Remove title and desc | Accessibility text | None visually, hurts accessibility |
Answers
SVG Optimizer FAQ
Questions people ask about the SVG Optimizer, answered for this specific use case.
Will optimizing change how my SVG looks?
With the default settings it should look identical. Compare the Original and Optimized previews to be sure.
What does the optimizer remove?
The XML declaration, DOCTYPE, metadata, editor-specific attributes, comments and extra whitespace, and it shortens colors and rounds numbers.
What number precision is safe?
Three decimals are safe for almost all artwork. Use more for technical drawings and fewer for simple icons.
Does it keep the title and description?
Yes by default, because they help accessibility. You can switch the option on to remove them.
How is this different from the SVG Minifier?
The SVG Minifier is lossless by default and leaves numbers untouched. The optimizer also rounds numbers for extra savings.
All converters
Every free converter and SVG tool
43 free tools that run in your browser. Pick a converter below, or search by format or task.
No converter matches that search. Try “SVG”, “logo” or “PNG”.