XML Formatter

Free online XML formatter and parser: paste XML to parse and pretty-print it, check it for errors, or minify it — right in your browser.

Suggested tools

JSON Formatter

Beautify, minify and validate JSON instantly in your browser.

JSON
Open Tool

YAML Formatter

Re-indent YAML and check it for syntax errors, with line numbers.

YAML
Open Tool

JSON5 Formatter

Format JSON5 with comments, unquoted keys and trailing commas.

JSON5
Open Tool

HTML Formatter

Indent and tidy HTML, or minify it.

HTML
Open Tool

CSS Formatter

Beautify minified CSS into readable rules, or minify it.

CSS
Open Tool

SQL Formatter

Beautify or minify SQL queries in your browser.

SQL
Open Tool

About XML Formatter

XML Formatter beautifies, minifies and validates XML — sitemaps, RSS feeds, SOAP envelopes, WSDL files, Android layouts, Maven POMs and any other XML. Beautify adds clean indentation; Minify removes whitespace between tags; Validate checks that the document is well-formed.

It also works as an online XML parser: the document is parsed before formatting, so errors such as an unclosed tag are reported with their line. Element order and attribute values are preserved exactly. It runs entirely in your browser, so nothing you paste is uploaded.

How to use XML Formatter

  1. Paste XML, upload a file or click Sample.
  2. Press Beautify, Minify or Validate.
  3. Copy or download the result.

Key features

  • Beautify, Minify and Validate
  • Works with SOAP, WSDL, RSS and sitemaps
  • Element order preserved
  • Clear well-formedness errors

Example

One-line XML, indented so the structure is easy to read.

Input
<note><to>Team</to><from>Asha</from><body>Release on Friday</body></note>
Output
<note>
  <to>Team</to>
  <from>Asha</from>
  <body>Release on Friday</body>
</note>

When to use XML Formatter

  • Reading SOAP responses, sitemaps or RSS feeds that arrive on one line.
  • Tidying Maven, Android or other XML config files.
  • Checking that XML is well-formed before sending it to an API.

Tips and common problems

  • Validate tells you the line of the first problem — fix it and validate again.
  • A bare & is the most common error; write it as &amp;.
  • Minify before embedding XML in another file or a request body.

Frequently asked questions

Yes — they are XML documents, so they format like any other XML.