Launch ToolkitCalculatorsConvertersDeveloperTextAll toolsLaunches
Launch your project Sign in
Theme
Home/Developer/XML Formatter

XML Formatter

Paste XML and this page indents each nested tag by two spaces. It does not validate against a schema or call a server.

Runs in your browser. Nothing you enter is uploaded.

Worked examples

Input <root><item id="1">Hello</item><item id="2"/></root>

Output<root> <item id="1">Hello</item> <item id="2"/> </root>

A tag that already contains its text and its closing tag on one token stays on one line. Self-closing tags do not add a level.

Indent rules

TokenWhat happens
Opening tagPrinted at the current indent, then the indent increases
Closing tagIndent decreases, then the tag is printed
Self-closing tag, or <? or <!Printed, indent unchanged
Whitespace between tagsRemoved before the split, so gaps do not become extra lines

Format and beautify XML so deeply nested elements become readable with consistent indentation. Minified or single-line XML from SOAP responses, RSS feeds, SVG files and config exports is nearly impossible to scan by eye, and this tool fixes that instantly. It indents each level, keeps attributes on their opening tags, preserves text content, and leaves self-closing tags intact. It works purely on the text structure, so it does not rewrite or strip your data, it just makes it legible. Paste your XML, click format, and copy the tidy result. All formatting happens in your browser, so proprietary payloads and internal service responses are never uploaded or stored anywhere.

How to use XML Formatter

  1. Paste messy or minified XML.
  2. Click format to pretty-print it.
  3. Copy the indented XML.

Frequently asked questions

Does it check that the XML is valid?

No. It pretty-prints the text. A broken tag is not reported as a parse error by this formatter.

How wide is each indent?

Two spaces per level.

Is the XML uploaded?

No. Formatting runs in the browser.

Is XML Formatter any good?

Give your verdict. Sign-in needed to vote and comment.

Badge

Link this tool from a README, doc or site. The badge links back to this page.

Listed on yourhack.ai

[![Listed on yourhack.ai](https://yourhack.ai/badge/xml-formatter.svg)](https://yourhack.ai/xml-formatter)