SVGs exported from Illustrator, Inkscape, Figma or Sketch often carry a lot that browsers never use: XML declarations, DOCTYPEs, editor comments, metadata blocks and namespaced attributes such as sodipodi and inkscape that only the original application understands. For a single icon that may be a few kilobytes, but with dozens of icons on a site, or SVGs inlined directly in HTML, the excess slows loading and makes the markup hard to read.
This tool offers five cleanup options you can toggle individually: remove comments; remove the XML declaration and DOCTYPE; remove metadata and editor-only elements such as sodipodi and inkscape; remove editor attributes and unused namespace declarations; and collapse whitespace between tags and repeated spaces. Afterwards it shows original and optimized previews side by side, along with file sizes and the percentage saved, so you can check the result before copying the code or downloading a new .svg file.
The tool uses conservative text cleanup. It does not rewrite path data, round coordinates or merge shapes, so the appearance should hardly change; in exchange, savings are usually smaller than with tools like SVGO that rewrite paths. Namespace declarations are removed only when unused: if the file still contains xlink:href, xmlns:xlink is kept, so a standalone .svg file keeps rendering. Whitespace compression skips the contents of <text> (including nested <tspan>), <style> and <script>, and xml:space="preserve" is kept, so text spacing and CSS are unaffected. Because processing is regex-based, compare the previews before using the result if your file uses unusual markup.
All processing happens in your browser and files are never uploaded. If you need the optimized graphic somewhere that does not accept vectors, such as some social platforms or Office documents, convert it to PNG with our image converter.