SVG Code Optimizer
100% PrivateFile & Data ConversionClean up SVG markup with safe, visible rules and see the bytes saved.
Runs entirely in your browser. Your input is not uploaded to Ovatly or anywhere else.
These rules never rewrite path data, shapes, text or attribute values, so the picture cannot change shape. Whitespace inside styling or scripts is still code, though: if your SVG carries animations, embedded CSS or scripts, compare the preview carefully before using the optimized file, and keep your original.
- 1Paste your SVG code, or load an .svg file with the file box.
- 2Tick the cleanup rules you want; the defaults are conservative and the XML declaration is kept unless you choose otherwise.
- 3Press Optimize SVG and read the result panel: sizes, saving percentage and the list of rules that actually changed something.
- 4Compare the before and after previews, then copy or download the optimized code.
An exported icon of 393 bytes, carrying an XML comment, a metadata block, a sodipodi:namedview element, an empty group and fill="#ffffff", comes out at 187 bytes with the default rules: a 52.4% saving. The result panel lists the five rules that fired, the rectangle is untouched except its fill, now #fff, and the previews look identical.
- Path data, shapes, text and attribute values are never rewritten, so the picture cannot change shape. Only markup around them is cleaned.
- Whitespace runs that contain a newline between tags are collapsed; if an SVG relies on exact whitespace inside styled text, compare the preview before using the output, and keep your original either way.
- This is a conservative rule set, not a full minifier like SVGO: it will not rename IDs, merge paths or round coordinates, so its savings are smaller but its behaviour is predictable.
The rules cannot change geometry or colors (only their spelling, #ffffff to #fff). The page shows before and after previews side by side so you can confirm the picture is unchanged before downloading.
About this tool
The SVG Code Optimizer cleans up SVG markup with a small set of safe, visible rules: comments out, editor leftovers from Inkscape and similar tools removed, empty groups dropped, hex colors shortened and stray whitespace collapsed. You see exactly which rules changed something, the before and after sizes, and a preview of both versions.
Related tools
Part of Ovatly's free tools in File & Data Conversion.