SVG Formatter and Inspector
Re-indent an SVG exported as one long line so it is readable and reviewable in version control, or minify it back down. Alongside the formatting, a summary reports what the file actually contains: whether it has a viewBox (without one the graphic cannot scale), which elements it uses and how many, how long its largest path is, and whether it embeds a raster image as a data URI or contains a script element.
How it works
Re-indents the document one element per line so a graphic exported as a single long line becomes readable and reviewable in version control. Comments, CDATA sections and the XML declaration are kept, because a parse-and-rebuild round trip is exactly what loses them.
The summary below reports what the file contains and flags the things that usually matter: whether there is a viewBox (without one the graphic cannot scale), whether a raster image is embedded as a data URI, and whether there is a script element.
Everything runs in your browser — nothing you paste is uploaded.
Frequently asked questions
Why does a missing viewBox matter?
The viewBox is what lets an SVG scale to whatever size its container gives it. Without one the graphic renders at its fixed width and height, or in some contexts does not render at all — which is why a file with no viewBox is flagged in the summary.
Should I remove the width and height attributes?
If a viewBox is present, removing width and height lets CSS size the graphic while the viewBox keeps its proportions, which is usually what you want for an icon or an illustration in a responsive layout. Keeping them is fine when the graphic should always render at one size.
Why does the tool point out a script element?
An SVG can contain a script. Renderers that treat the file as an image ignore it, but a file used inline in a page can run it — which is worth knowing about if the SVG came from somewhere you do not control.
What usually makes an SVG file large?
Two things: a raster image embedded as a data URI, which is not vector content at all, and very long path data. Both are reported in the summary, with the longest path measured in characters, because simplifying paths in your drawing tool is normally the biggest saving available.
Does formatting change how the SVG renders?
No. Only whitespace between elements changes; attributes, path data and element order are untouched, and comments and CDATA sections are kept rather than being dropped by a parse-and-rebuild round trip.
Related tools
XML Formatter & Beautifier
This XML formatter re-indents minified or messy XML while preserving comments and CDATA.
Image Format Converter
Convert an image between JPEG, PNG and WebP with adjustable quality, entirely in your browser.
Favicon Generator
Turn any image into a complete favicon package — .ico file, PNG sizes, Apple touch icon and manifest icons — in one ZIP.