SVG Optimizer & Editor

Paste an SVG, minify it, inspect its dimensions, then copy or download the optimized file.

Free online SVG optimizer and editor. Minify SVG markup, strip editor cruft and metadata, round coordinates, read width/height/viewBox, preview live, then copy or download — 100% in your browser, nothing uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What does an SVG optimizer actually remove?

It strips things that browsers never render — XML comments, editor metadata (Inkscape, Illustrator and Sodipodi namespaces), empty and default attributes, redundant whitespace between tags, and the optional XML declaration and DOCTYPE. It also rounds long coordinate numbers to a chosen precision, which is usually where the biggest savings on hand-exported icons come from.

An SVG optimizer and editor that cleans up vector markup the way a build pipeline would, but instantly and entirely in your browser. Paste or upload an SVG and it strips the data that browsers never render — comments, editor metadata, empty and default attributes, redundant whitespace — rounds bloated coordinate numbers to a precision you choose, and reports the exact byte savings. It is built for designers exporting icons from Illustrator or Inkscape, developers inlining SVGs into a component, and anyone who just wants to know an SVG’s real dimensions without opening a heavy editor.

Vector files exported from design tools are notoriously wasteful. A single icon can carry kilobytes of inkscape: and sodipodi: namespace junk, a <metadata> block, decorative whitespace, and coordinates printed to fourteen decimal places like 120.000000000001. None of that affects the rendered image, yet it inflates every page that ships the file. This tool removes it in one pass and shows you the before-and-after size so the win is measurable, not guesswork.

What optimisation removes and rewrites

The optimizer parses your markup with the browser’s native XML parser, so it understands real SVG structure rather than guessing with regular expressions. It then walks the document tree and applies the passes you have enabled: removing comment, metadata, title and desc nodes; deleting editor-namespaced elements and attributes; dropping empty and default attributes such as version="1.1" or x="0"; and rounding every coordinate-bearing value — path d data, points, transform, radii and stroke widths — to your chosen decimal precision. Finally it serializes the cleaned tree back to text, collapses the whitespace between tags, and optionally removes the XML declaration and DOCTYPE. A live preview renders the result so you can confirm nothing broke, and the metrics panel reports original size, optimized size, percent saved, the width, height and viewBox, and the element and path counts. Everything — including your last input and toggle choices — stays on your device.

Example

Take a 240×240 icon exported from a vector editor. The source weighs in with an XML prolog, a comment, an inkscape namespace declaration, a metadata block, a <desc>, version="1.1" x="0" y="0", an empty fill="", and coordinates like cx="120.000000" and r="100.123456". With the default passes enabled, the optimizer deletes the comment, metadata and editor data, removes the redundant root attributes, rounds 100.123456 to 100.12, collapses the indentation, and serializes a single tidy line of markup.

PassEffect
Strip editor dataRemoves inkscape:/sodipodi: attributes and the xmlns:inkscape declaration
Remove metadataDeletes metadata, title and desc nodes
Round coordinates100.123456 becomes 100.12 at precision 2
Collapse whitespaceJoins indented lines into compact markup

The result is typically 40 to 70 percent smaller, ready to copy straight into a component or save as optimized.svg. Switch to the readable view first if you would rather keep the markup indented for a codebase. No file is ever uploaded.

Keep the parts that make SVG accessible and scalable

Aggressive optimisation can strip things you actually need. Two protections worth understanding before you minify:

  • viewBox must survive. Some optimisers remove width/height or the viewBox to save bytes; removing the viewBox breaks proportional scaling — the whole point of vector graphics. This tool preserves it.
  • <title> and <desc> are not junk. They are the accessible name and description of the graphic, announced by screen readers, per the W3C’s SVG accessibility guidance. Strip them from purely decorative icons (and add aria-hidden="true" in the host HTML), but keep them on informative graphics like charts and diagrams.

Precision, gzip and where the real bytes go

Coordinate precision is the biggest lever: an export with six decimal places per coordinate (12.483920) carries illusory accuracy — screens cannot render a millionth of a pixel — and rounding to 1–2 decimals routinely cuts path data by a third with no visible change. The counter-intuitive part is compression: SVG served over HTTP is almost always gzip- or brotli-compressed, and repetitive XML compresses extremely well (see MDN’s SVG documentation for delivery guidance), so the uncompressed saving overstates the transfer saving. Optimise for the compressed size when SVGs ship on the web — and for parse time on low-end devices, where fewer path commands still help even when the transfer saving is modest.