SVG Optimizer
Optimize and minify SVG files with SVGO, see the size saved and a before and after preview, then copy or download the smaller SVG. Runs in your browser.
Input
Output
Readme
Why optimize an SVG?
SVG files saved by design tools such as Illustrator, Inkscape, Figma or Sketch carry a lot that never shows on screen: editor metadata, comments, hidden layers, unused definitions, empty groups and numbers with far more decimal places than any screen can draw. Removing it often makes icons and logos noticeably smaller, so pages load faster and inline SVGs in HTML, CSS or JavaScript take less room, with no visible change.
How to use it
- Paste SVG code, or switch to Upload and pick an .svg file.
- The optimized SVG appears right away, with the original and optimized sizes, the percentage saved, and the two versions side by side so you can check nothing changed.
- Copy the optimized code, or download it. An uploaded file keeps its name with .min.svg added.
Settings
- Decimal places: how many digits after the decimal point numbers keep, in coordinates, paths and transforms. 3 is safe for almost every graphic; 1 or 2 shrinks icons further but can shift fine details, so compare the previews.
- Repeat until nothing more changes (multipass): runs the optimizations again as long as they keep finding something, for the smallest result.
- Remove width and height, keep the viewBox: makes the SVG scale to the size of its container, which is what you usually want for icons in a responsive layout. The viewBox stays, so the proportions don't change.
- Indent the output: puts each element on its own indented line, for reading or editing by hand instead of the smallest file.
What gets changed
The optimizer uses SVGO's default preset, the same one most build tools use. Among other things it:
- Removes comments, the XML declaration, doctype, editor namespaces and metadata
- Removes hidden elements, empty groups and containers, and unused definitions
- Shortens colors (#ff0000 becomes red) and numbers, and merges or converts shapes and paths into shorter path data
- Collapses useless groups and moves shared attributes up
- Keeps the title and the viewBox, which matter for accessibility and scaling
Privacy
The SVG is optimized in your browser with SVGO, the standard open source SVG optimizer. Nothing is uploaded, and the previews show the SVG as an image, so scripts an SVG may contain never run.
Features
- SVGO with its default preset
- Paste code or upload a file
- Before and after previews on a transparency checkerboard
- Original size, optimized size and percent saved
- Decimal places, multipass, responsive sizing and indented output
- Copy or download the result
- Runs in your browser