Code Tools

XML Formatter

All tools

Lay out flat XML with one element per line so nesting errors and missing nodes stand out.

How it works

Four simple steps

1

Set the declaration aside

Cut the <?xml ... ?> line if your document starts with one.

2

Paste or drop XML

Add the feed, SOAP body or config file to the input panel.

3

Read the tree

Elements are indented two spaces per level as you type.

4

Copy or save

Copy the result or download formatted.xml, then restore the declaration.

XML Formatter

About XML Formatter

A partner sends a product feed or a SOAP response with no line breaks, and you need to check whether every item has a price element. Indenting the document turns that check from squinting into scrolling.

The XML formatter uses the same tag-aware indenter as the site's HTML formatter. Each element starts on a new line, children are indented two spaces, self-closing elements such as <item/> do not open a new level, and comments and CDATA sections are preserved. Element text is placed on its own line under the tag. Formatting is live, files can be dropped onto the input, and Download produces formatted.xml.

Two caveats are worth knowing. The XML declaration and other processing instructions (lines starting with <?) are not recognized as tags and lose their leading angle bracket, so cut the declaration before formatting and paste it back on top. And because text moves onto its own line, treat the output as a reading copy; whitespace-sensitive consumers may see extra spaces in values. If you need the data itself, convert it with XML to JSON, or build XML from an object using the JSON to XML converter. Sitemaps have a dedicated sitemap validator.

The document never leaves the browser while it is being indented, which matters for SOAP payloads that carry account numbers or tokens.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

No. It indents whatever tags it finds and will not report a mismatched closing tag. Run the document through XML to JSON, which uses the browser's strict XML parser and stops with an Invalid XML message when the markup is broken.

Usually, but check text values. A short element like 9.99 becomes three lines with whitespace around the number. Parsers that trim text cope fine; strict comparisons may not.

View more FAQs

Related tools

View all

HTML Formatter

Beautify and indent HTML markup.

Open

CSS Formatter

Format and pretty-print CSS.

Open

JS Formatter

Beautify JavaScript code.

Open

JSON Formatter

Beautify and validate JSON.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools