Free · Private · No sign-up

SVG Prettifier & XML Formatter

Format SVG markup online with native XML parsing, 2 or 4 space indentation, and optional attribute sorting. Preserve paths, styles, text, and namespaces.

1 Compact SVG

Native XML parser

2 Formatted SVG

Readable recursive output
Input: — Output: —

Your file is processed on this device and never uploaded.

How it works

From input to output,
in a few clicks.

Turn dense editor exports into readable SVG source without minifying away meaningful content. A recursive XML formatter indents element structure, preserves mixed text and style content, and reports syntax errors instead of attempting unsafe regular-expression repairs.

  1. Paste or upload SVG XMLLoad a valid SVG document into the source editor, including any titles, descriptions, styles, namespaces, and path data.
  2. Choose formatting rulesSelect two-space or four-space indentation and optionally sort each element’s attributes by qualified name.
  3. Format and inspectCompare line counts and byte sizes, review syntax feedback, then copy or download the readable SVG document.

Good to know

Frequently asked questions

Does the formatter preserve path data?

Yes. Attribute values such as path d commands are kept as parsed XML values and are never split, normalized, or rewritten by regular expressions. Only their surrounding attribute layout can change.

What happens to title, desc, text, and style content?

Elements containing meaningful text or CDATA are serialized inline as mixed content so their character data and internal whitespace are retained. Style rules are not passed through an HTML formatter.

Why can’t malformed SVG be prettified?

Reliable formatting needs a valid XML tree. If the native parser reports mismatched tags, invalid entities, or another syntax error, the tool shows that message and clears the output rather than guessing at a repair.