XML Formatter

Parse an XML document and indent it by hierarchy.

Category: Dev Tools

When to use?

Use it to tidy one-line minified XML — SOAP API responses, RSS feeds, sitemap.xml — for readability.

How to use

  • Paste the XML code.
  • Press format to indent by hierarchy.
  • Copy the tidied XML.

Input Explanation

Paste the XML string to parse (API response, RSS feed, etc.).

Calculation Basis

It converts the XML text into a DOM Document with DOMParser, traverses the node tree hierarchically, and inserts tabs and line breaks proportional to depth for a readable tree.

Usage Examples

  • Check API responses - Tidy SOAP, RSS, and sitemap XML responses for readability.
  • Quick pre-deploy check - Check inputs and output to reduce errors before dev/ops work.
  • Aid docs/reviews - Copy the tidied result into dev docs, issues, or review comments.

Examples

  • <root><item>A</item></root> → an XML document hierarchized by tag
  • A one-line XML API response → expanded by hierarchy for debugging

Cautions

  • Generated output is for reference; test carefully before production use.
  • XML tidying runs only in the browser parser and is not sent to a server.

Guides

XML indentation

It aligns XML tags and attributes by hierarchy for readability. Useful for analyzing API responses, config files, and RSS feeds.

Check XML syntax

It also catches basic syntax issues like unclosed tags or missing attribute quotes.

FAQ

How is invalid XML shown?

If the browser XML parser detects an error, it shows the error message.

Is the pasted XML sent out?

No. XML tidying runs only via the browser parser and is not sent out.

Are tags with many attributes tidied?

Tags with several attributes are indented by hierarchy for easier structure reading.

Is the XML declaration kept?

It keeps the leading XML declaration and namespaces while indenting the body.

Related Tools

  • JSON Formatter - Beautify or minify JSON strings instantly and check for validity errors.
  • UUID Generator - Generate up to 20 cryptographically secure UUID v4 values at once.
  • Password Generator - Generate secure random passwords in the browser by choosing length, character set, and count.
  • JWT Decoder - Decode a JWT header and payload to view the JSON and key claims.
  • Regex Tester - Enter a regex pattern to see matches in text in real time.
  • QR Code Generator - Convert text or a URL into a QR code and download it as an image.