An icon set is where SVG weight quietly multiplies. One exported icon might carry a few hundred spare bytes of comments, metadata and empty groups, which sounds like nothing. Thirty icons carry thirty copies of that baggage, and a header or sidebar that loads the set downloads all of it, on every page.
The catch is that the free SVG Code Optimizer on Ovatly works on one file at a time. There is no batch mode and no folder upload. That sounds like a drawback, but it pushes you into the approach that actually works for a set: a fixed routine, repeated. Same rules ticked, same quick preview check, icon after icon. This guide walks through that routine.
Contents
- Quick answer
- The honest bit first: one file at a time
- Why a set benefits more than a single file
- Fix the rules before you start
- How to work through the set, step by step
- Worked example: one icon from the set
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
There is no batch button. Open the SVG Code Optimizer, decide on one rule selection and keep it for the whole set: comments out, editor leftovers removed, empty groups dropped, hex colors shortened, stray whitespace collapsed, XML declaration kept. Then work through the icons one at a time: paste or load the file, press Optimize SVG, check the result panel and the preview, download, move to the next. The per-file saving is modest; the set saving, repeated over every page view, is the point.
The honest bit first: one file at a time
Plenty of tools promise to process a whole folder at once. This one does not, and pretending otherwise would waste your time. You paste SVG code or load a single .svg file, the cleanup runs, and you take the result. One icon, one pass.
What you get in exchange is visibility. Each pass shows you the before and after sizes, the saving percentage, the exact rules that fired, and previews of both versions. On a set, that per-file check is worth having: an icon with a script or an animation gets a human glance instead of being swept through unseen. A set of a few dozen icons takes minutes, not an afternoon.
Why a set benefits more than a single file
Editors export every icon the same way, which means every icon carries the same kinds of leftover: an XML comment, a metadata block, elements from the sodipodi and inkscape namespaces, groups that ended up empty, six-digit hex colors where three digits would do, and generous indentation. Browsers render none of it, but they download all of it.
On one file, removing that material saves a sliver. Across a set, the slivers stack, and the saving repeats: an icon set usually sits in a header, a navigation bar or a feature grid, the parts of a site that load on every page. Bytes removed from the set are bytes removed from every page view.
Fix the rules before you start
Decide the rule selection once, before the first icon. The default selection is the sensible set-wide choice: it takes comments out, removes editor leftovers and empty groups, shortens hex colors such as #ffffff to #fff, and collapses stray whitespace, while keeping the XML declaration for standalone files.
The reason to fix the selection in advance is consistency. A set should be cleaned one way, not thirty ways. Change your mind halfway through and the two halves of the set differ, with no record of which files got which treatment. One selection also turns the job into a rhythm: after two or three icons you stop reading the rule list and just work.
How to work through the set, step by step
- Keep your original exports in their own folder. The optimized files are delivery copies, so set up a second folder for them and never overwrite the source set.
- Open the SVG Code Optimizer and tick your chosen rules. The defaults described above suit most sets; add the XML declaration rule only if every icon will live inline in HTML.
- Paste the first icon's code, or load the .svg file, and press Optimize SVG.
- Read the result panel: both sizes, the saving percentage, and the list of rules that actually fired. A rule that did not fire simply found nothing to remove in that file, which is normal.
- Compare the previews. They should be identical; this glance matters most for any icon with animation or a
<style>block, where whitespace can be code. - Download the optimized file into the delivery folder, keeping the same file name so references still resolve.
- Repeat for the next icon without touching the rule selection. When the delivery folder holds the full set, swap it in as one change and check the pages that use it.
Worked example: one icon from the set
Take one exported icon of 393 bytes. It carries an XML comment, a metadata block, a sodipodi:namedview element, an empty group and a rectangle filled with #ffffff. Run it through the default rules and it comes out at 187 bytes, a 52.4 percent saving, with five rules fired, one for each kind of leftover. The rectangle is untouched apart from its fill, now #fff, the same white spelled shorter. Your icons will each save a different amount, but the pattern repeats: whatever fraction one export sheds, its siblings shed something like it.
Limitations and honest tradeoffs
The one-file pace is the obvious tradeoff. A set of hundreds of icons is a long routine, and this tool will not shorten it. The optimizer is built for care, not volume.
The rule set is also deliberately conservative. This is not SVGO: no IDs are renamed, no paths are merged, no coordinates are rounded. Those tricks save more bytes but change the drawing's underlying data, which can break shapes, animation hooks or CSS references. Here, path data, shapes, text and attribute values are never rewritten, so the ceiling on savings is lower and the behaviour is predictable.
Animated and scripted icons need the caution the tool itself flags: whitespace inside a <style> block can be code, and the whitespace rule collapses runs of it. Compare those previews carefully and keep the originals.
Common mistakes
- Changing the rules mid-set. Half the set ends up cleaned one way, half another. Fix the selection first and leave it alone.
- Overwriting the original exports. The cleaned files have no editor settings in them. Keep the source set separate, always.
- Skipping the preview to save time. The preview glance is the safety check that replaces batch trust. It takes seconds per icon.
- Judging by one icon's percentage. A small saving on a clean icon is a good result. Judge the set by its total before and after size.
- Renaming files during the pass. Keep names identical so the delivery folder drops in without breaking references.
FAQs
Is there a batch mode for a whole folder of icons? No. The optimizer works on one file at a time: you paste the code or load the .svg file, run the rules, and download the result. For a set, the practical approach is a routine: keep the same rules ticked and work through the icons one by one, which also lets you glance at each preview as you go.
Why should I use the same rules for every icon in the set? Because a set ships together. If one icon keeps its comments and metadata while the rest are cleaned, the set is inconsistent and the leftover file carries weight the others dropped. One fixed rule selection also makes the job faster, since you stop deciding and just repeat.
Will optimizing change how my icons look? No. The rules remove markup around the drawing and respell values without changing them, for example #ffffff becomes #fff. Path data, shapes, text and attribute values are never rewritten, and the page shows before and after previews for each file so you can confirm the picture is identical.
How much smaller will my icon set get? It depends on how much baggage each export carries. In the tool's worked example, one file went from 393 bytes to 187 bytes, a 52.4 percent saving, because it was full of editor leftovers. A hand-cleaned icon may save almost nothing. The set total is what matters: small savings repeated over every icon and every page view.
Should I keep the original icon files? Yes. Keep the editor exports as your editable source set. The cleaned files are delivery copies: the editor settings are gone from them, and with animated or scripted SVG the original is your fallback if a preview shows something off.
Conclusion
Shrinking an icon set with the SVG Code Optimizer is a routine, not a batch job: one fixed rule selection, one file at a time, a preview glance for each, and a clean delivery folder at the end. The set ships lighter and, just as usefully, uniformly cleaned. Files raise a different question once they are ready to send somewhere: our companion guide on checking an MP3's bitrate before uploading it covers verifying an audio file before it leaves your device. For more guides in this series, see our File and Data Conversion guides.
References
- MDN Web Docs, on SVG and how browsers render it: https://developer.mozilla.org/en-US/docs/Web/SVG
- W3C, the SVG 2 specification: https://www.w3.org/TR/SVG2/