SVG Optimizer
Shrink SVG files by removing editor data, comments and excess precision, with a before-and-after preview.
Compare both previews: if they differ, use more decimals.
About this tool
SVG files exported from Illustrator, Inkscape, Figma or Sketch carry a lot that browsers never use: editor metadata, comments, hidden layers, empty groups and coordinates with six decimal places. Removing it often makes icons and illustrations half the size or less, which means faster pages and cleaner markup to inline.
This optimizer runs SVGO, the open-source optimizer used by many web build tools, directly in your browser. You choose how many decimals to keep, whether to remove scripts, titles and fixed dimensions, and compare a before-and-after preview to be sure nothing changed visually. Files are never uploaded.
How to use SVG Optimizer
- Paste SVG markup or open an .svg file. A sample Inkscape icon is loaded so you can see the effect right away.
- Choose the number of decimals. 3 is safe for almost everything; 1 or 2 is fine for icons drawn on a pixel grid.
- Keep Remove scripts and event handlers on, especially for files from other people.
- Turn on Remove width/height if the icon should scale with CSS, and turn off Keep <title> only if the image is purely decorative.
- Compare both previews, then copy the result or download it as name.min.svg.
Examples
The sample Inkscape icon
1,001-byte SVG with XML declaration, comment, sodipodi and inkscape data, empty <defs> and a layer group
297 bytes (70% smaller), the same drawing, <title> kept
Path data and colors
<path d="M 10.123456,20.987654 L 30.555555,40.444444" fill="#ff0000"/>, 2 decimals
<path fill="red" d="m10.12 20.99 20.44 19.45"/>
Coordinates are rounded and rewritten as shorter relative commands; #ff0000 becomes the shorter name red.
An icon that scales with CSS
width="48" height="48" viewBox="0 0 48 48", Remove width/height on
Only viewBox="0 0 48 48" remains, so CSS width and height decide the size
What gets removed
- The XML declaration, doctype and comments.
- Editor data such as sodipodi:namedview, inkscape:* attributes and <metadata>.
- Hidden elements, empty groups, unused definitions and namespaces, and IDs that nothing in the file refers to.
- Default attribute values, redundant groups and excess precision in numbers.
- With the option on: <script> elements, onclick-style event attributes and javascript: links.
Precision: smaller files versus exact shapes
Most of an SVG’s size is numbers in path data. Each decimal you drop saves one character per coordinate, but rounding too far moves points: curves can wobble and thin shapes can shift by a fraction of a unit. An icon with a 24-unit viewBox shown at 24 pixels is safe at 1 or 2 decimals, because 0.01 units is a hundredth of a pixel. Detailed illustrations, maps and logos that will be shown large are safer at 3. If the two previews differ, add a decimal.
Frequently asked questions
Everything you need to know about this tool and data security.
Is my SVG uploaded?
No. SVGO runs as JavaScript in your browser, and the previews are drawn locally.
Can optimization break my SVG?
Rarely, but check two cases. If CSS or JavaScript outside the file targets elements by ID, those IDs look unused and are removed, so test the result in your page. And if shapes look slightly off, increase the number of decimals.
Why keep <title>?
Screen readers use <title> and <desc> to describe an inline SVG. Remove them only for purely decorative images that have aria-hidden="true" or an empty alt text.
Is it safe to put SVG files from others on my site?
SVG can contain JavaScript that runs when the file is opened directly or inlined. With Remove scripts and event handlers on, this tool strips <script> elements, event attributes and javascript: links. The previews use <img>, which never runs scripts.
Should I gzip SVG too?
Yes. Optimization removes content; gzip or Brotli on the server compresses what remains. Together they give the smallest transfer size.
Is my data safe when using this tool?
Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.
Related Tools
Convert an image to a Base64 data URI and copy it as an img tag, CSS background, Markdown or JSON string.
Create favicon.ico, Apple touch and Android icons plus the web manifest from an image or a letter, ready to upload.
Compress JPEG, PNG, and WebP images client-side while preserving visual clarity.
Featured Projects tech-fun.net
Explore more AI & productivity tools
Nihongo GameBox
Master Japanese typing, Kana, and JLPT N5–N1 vocabulary through interactive retro arcade games.
ResumeGPT
Tailors CVs and cover letters to every job opportunity with a multi-agent LLM pipeline, job tracking, and scheduled discovery.
CollectMind
Turns your bookmarks into a searchable AI knowledge base — entirely on-device, powered by Chrome's built-in Gemini Nano.