Home › Toolkit › Developer › XML Formatter

🗂️ XML Formatter

A sitemap on one line, a feed that will not validate, a config nobody dares touch. Paste the XML: this formatter indents it by structure and checks it with a real XML parser, naming the error when it finds one.

About this tool

XML still runs a quiet empire underneath the web: sitemaps that search engines read, RSS feeds, SVG images, office document formats, enterprise configs. It is also merciless about structure — one unclosed tag invalidates the whole file, and the file will not tell you where unless you ask a real parser. This tool asks one: the browser's built-in XML parser validates first, and only then does our formatter indent by nesting depth.

The formatting rule is conservative on purpose: element structure gets new lines and indentation, while text content is left exactly as written, because in XML whitespace inside an element can be meaningful. Attributes stay on their tag's line. The result is a document you can finally read top to bottom — and diff, review and hand-edit with confidence.

How to use it

  1. Paste your XML.
  2. Press Format & validate.
  3. If an error is reported, fix the named problem and run it again; otherwise copy the indented result.

Good to know

  • The classic faults: an unclosed tag, a raw & that should be &amp;, and mismatched case — <Item> does not close </item>.
  • Pretty-printing a sitemap before submitting it makes manual URL checks far easier on the eyes.
  • XML declarations (<?xml …?>) and comments are preserved at the top and in place.

Frequently asked questions

Is formatting the same as validating?

No — and this tool does both, in the right order: the parser validates first; if the document is broken, you get the error instead of misleading pretty output.

Will it change my data?

Only layout between elements. Text content and attributes are preserved as written.

Does it work for SVG files?

Yes — SVG is XML, so icons and illustrations format and validate the same way.

More Developer tools

Making videos too? Try our YouTube SEO Checker, or browse the full Toolkit and the free YouTube tools.