SVG Formatter
Re-indent minified SVG markup so it can be read and edited.
Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.
How to use the svg formatter
- Paste minified SVG.
- Choose the indent size.
- Copy the formatted result.
About this tool
The reverse of minifying, for when you have a one-line SVG and need to find the element you want to change.
Indentation follows nesting, and text content stays on the line of the element that holds it rather than being pushed onto its own — which keeps a <code>text</code> element readable and, more importantly, avoids introducing whitespace that would change what is rendered.
Only layout changes: no attributes are reordered, nothing is removed, and the markup is otherwise byte-identical in meaning. Formatting then minifying returns you to where you started.
This works on the markup as text rather than parsing it into a tree, so it performs only the changes that are safe without one. It will not merge paths, remove unused definitions or restructure groups the way a full optimiser such as SVGO does. A live preview is shown so you can confirm the result still renders.
Common uses
- Making a one-line SVG editable.
- Reading an icon exported by a build tool.
- Reviewing SVG changes in a diff.
Frequently asked questions
- Does formatting change the image?
- No. Only layout changes, and whitespace inside text elements is left alone so nothing rendered is affected.
- Can I minify it again afterwards?
- Yes. Formatting and minifying are reverses of each other, and round-tripping returns the same markup.
- Are attributes reordered?
- No. Attribute order is preserved exactly as you pasted it.
Related tools
SVG Optimizer
Strip editor metadata, comments and excess precision from an SVG, with a live preview.
SVG Minifier
Collapse an SVG onto one line and cut its file size, with a preview.
HTML Formatter & Minifier
Indent messy or minified HTML so it can be read, or strip it back down to one line.
XML Formatter & Minifier
Indent XML to reveal its structure, or minify it back to a single line.