SVG Minifier: Minify SVG Without Losing Anything
Remove whitespace, comments and metadata losslessly to cut SVG file size.
SVG Minifier tool
1Add your SVG
2Adjust the options
3Preview and download
Input and output codeView, edit and copy the code
Under the hood
How SVG Minifier works
An SVG minifier shrinks an SVG by removing whitespace, comments and metadata without changing any numbers. It is lossless by default, so the artwork stays exactly the same.
Read the formatted SVG
The minifier reads indented SVG with spaces, line breaks and comments that browsers do not need.
String length- BeforeMinified
Remove comments and metadata
Comments, the XML declaration, DOCTYPE, metadata and editor data are stripped.
Regex passes Collapse whitespace
Spaces and line breaks between tags are removed and repeated spaces are reduced, putting the whole SVG on one line.
Whitespace collapseLeave the numbers alone
Number precision is off by default, so coordinates are not touched. You can switch it on for more savings.
Precision off
Why minify without rounding
- Lossless
- Nothing visual can change because no numbers are altered.
- Predictable
- The result is the same artwork, just fewer bytes.
- Optional rounding
- You can turn on precision if you accept tiny changes.
Step by step
SVG Minifier process
Four steps minify an SVG. Lossless is the default.
Add your SVG
Drop a file, paste code or press the sample button. The sample is a pretty-printed SVG with comments.
Tip: Formatted files shrink the most.
Check the previews
Original and minified previews should look identical.
Tip: They will, unless you round numbers.
Add rounding if you want
Lower Number precision for extra savings.
Tip: Off means lossless.
BeforeAfterDownload the minified SVG
Press Download to save it.
Tip: Rendered locally.
Reference
SVG Minifier settings / conversion chart
The table compares minifying with other options. The chart shows typical contributions.
Typical contribution of lossless steps
At a glance
- Converts best: Whitespace.
- Needs the most care: Color shortening.
Guide: whitespace is the largest saving in pretty-printed files.
| Tool | Whitespace | Comments and metadata | Numbers |
|---|---|---|---|
| SVG Minifier (default) | Removed | Removed | Untouched |
| SVG Optimizer | Removed | Removed | Rounded to 3 decimals |
| SVG Compressor | Removed | Removed | Rounded to 1 decimal |
| SVG Code Formatter | Added | Kept | Untouched |
Answers
SVG Minifier FAQ
Questions people ask about the SVG Minifier, answered for this specific use case.
Is minifying lossless?
Yes by default. Whitespace, comments and metadata are removed but numbers are not changed.
What is the difference between minifying and optimizing?
Minifying removes only what is unnecessary. The SVG Optimizer also rounds numbers for extra savings.
Can I make the result even smaller?
Yes. Lower Number precision or use the SVG Compressor.
Will it break my SVG?
No. The previews should match, and you can compare them before downloading.
Is my SVG uploaded?
No. Minifying runs in your browser.
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”.