SVG Formatter / Minifier

Paste or type SVG and it is checked and formatted as you go. A document you are still writing is not an error, so nothing is flagged until you stop typing or leave the box.

How it works

The formatter checks that every opening tag has a matching closing tag, in the right order, before doing anything else — a mismatched or unclosed tag is reported with the specific tag name involved, instead of a generic parse error. Pretty print then re-serializes the document with one tag per line, indented by nesting depth. Minify instead removes comments and insignificant whitespace between tags, and collapses repeated spaces inside attribute values — the kind a design tool's export routinely leaves in a d, points, or transform attribute — down to a single space.

Frequently asked questions

What does "minify" actually strip?

Whitespace between tags, and any <!-- comment --> blocks, plus it collapses runs of repeated spaces inside an attribute value down to one — common in a d, points, or transform attribute exported by a design tool. It does not rewrite path data, round coordinates, or remove unused defs/ids: those are real optimizations, but a much bigger, riskier problem than whitespace, and out of scope for this tool.

Why does checking well-formedness matter specifically for SVG?

A browser silently drops a malformed SVG — an unclosed or mismatched tag renders as nothing, with no console error pointing at the cause. Catching that here, with the specific tag involved named in the message, is far more useful than discovering it later as a blank image on the page.

Does minify change how the SVG looks when rendered?

No — every change it makes (removing whitespace and comments, collapsing repeated spaces in an attribute value) is invisible to a renderer. If you need real file-size optimization beyond that — merging paths, stripping unused definitions, rounding numbers — that calls for a dedicated SVG optimizer, not this formatter.