SVG Cleaner
Make an SVG safer and smaller by removing scripts, editor data and extra whitespace.
How it works
- Paste your SVG code or open an .svg file.
- Choose the options you want.
- Copy or download the clean SVG.
About this tool
SVG files from design tools often hold editor data, comments and metadata that a website does not need. SVG can also contain scripts and event handlers, which is a risk if you show files from other people.
This tool removes scripts, event handlers, external links, comments, metadata and editor-specific attributes, trims whitespace and can round long numbers. It shows a preview and how much smaller the file became. Always check the preview to make sure the picture still looks right.
Questions
Is SVG safe to use on a website?
SVG from a source you trust is fine. Files from others should be cleaned of scripts and event handlers first.
Will the picture change?
Normally not. Check the preview, and turn off number rounding if you see any difference.
Why remove width and height?
With only a viewBox, the SVG scales to its container, which suits responsive designs.