What is XML Viewer/Formatter?

XML Viewer/Formatter takes minified or poorly formatted XML and turns it into cleanly indented, syntax-highlighted output. Validates XML structure, shows line numbers, and supports collapsible tree view — handy for reading API responses, config files, and other XML documents.

Validation runs entirely on your device, so namespaces, CDATA sections, processing instructions, and entity references are all handled the same way a serious XML library would. Switch indent between 2 spaces, 4 spaces, or tab, minify on demand, and use the tree view to collapse branches you don't care about right now.

How to use

  1. Step 1 — Paste raw or minified XML into the input area. Invalid XML is flagged with specific error locations.
  2. Step 2 — Choose your indent size (2 or 4 spaces, or tab) and view the formatted output with syntax highlighting.
  3. Step 3 — Copy the formatted XML, download it as a file, or use the tree view to explore deeply nested structures.

When to use

  • Reading SOAP responses, RSS feeds, or sitemaps that arrive as one giant line.
  • Debugging Android layouts, Maven pom.xml, or Spring config files with bad indentation.
  • Inspecting Office Open XML (.docx, .xlsx) internals after unzipping them.

Result

An API returns a single-line 50KB XML response. Paste it in to get properly indented output with color-coded tags, attributes, and values, so the error node buried 8 levels deep is easy to spot.

FAQ

Does it validate against a DTD or XSD schema?
It checks well-formedness — every tag closes, attributes are quoted, the document has one root. Schema validation against a DTD or XSD is a separate step that needs the schema file, which this tool doesn't load.
Will it preserve my CDATA sections and comments?
Yes. CDATA blocks stay intact and comments are kept where they appear. Insignificant whitespace inside elements may be re-indented, but anything inside a CDATA section is treated as opaque content.
Why does my XML show 'parsererror' even though it looks fine?
Common culprits: an ampersand that should be &, an unclosed tag, missing quotes around an attribute, or two root elements at the top level. The error line number narrows it down quickly.
Does the formatter handle very large XML files?
It runs entirely in your tab, so memory is the only limit. Files up to a few tens of megabytes format quickly on a typical laptop. Multi-hundred MB documents may freeze the page — split them first.
Can I format XML inside a JSON or YAML string?
Paste only the XML part between any surrounding quotes. The formatter expects a single XML document as input — if it's escaped (\" or <), unescape it first, then format, then re-escape on the way back.

Related Tools