What is the XML Formatter?
XML (Extensible Markup Language) remains widely used in SOAP services, RSS and Atom feeds, sitemaps, SVG graphics, Android layouts and enterprise integrations. Raw XML from services is frequently minified, making it hard to read. An XML formatter parses the document and writes it back with each element on its own line, indented by depth.
Because XML parsers are strict, a formatter doubles as a well-formedness checker. A document is well-formed when it has exactly one root element, every start tag has a matching end tag, tags are properly nested, attribute values are quoted, and special characters such as & and < are escaped as entities. Well-formed is not the same as valid: validation against an XSD or DTD schema is a separate step.
When to use the XML Formatter
Use it to inspect SOAP requests and responses, debug RSS or Atom feeds, check an XML sitemap before submitting it to search engines, tidy configuration files such as Maven or Android manifests, and read exports from legacy systems. A formatted tree makes the hierarchy obvious, and the well-formedness check tells you immediately whether a feed or payload will be rejected by a strict parser, long before a remote service returns a vague error.
How to use the XML Formatter
- Paste your XML into the input area.
- Select the indentation: 2 spaces, 4 spaces or tab.
- Press Format to pretty-print, or Minify to compact.
- If the XML is malformed, read the error message and the reported line and column.
- Copy the formatted document into your editor or request.
Examples
Input:
<?xml version="1.0"?><feed><entry id="1"><title>Hello & welcome</title><tags><tag>news</tag></tags></entry></feed>Formatted:
<?xml version="1.0"?>
<feed>
<entry id="1">
<title>Hello & welcome</title>
<tags>
<tag>news</tag>
</tags>
</entry>
</feed>Common errors and tips
- Unescaped ampersands are the most common error; write
&for a literal &. - Mismatched tags such as
<a><b></a></b>make a document not well-formed. - XML is case-sensitive:
<Item>and<item>are different elements. - Only one root element is allowed; wrap multiple siblings in a parent.
- Whitespace inside text nodes can be significant; use minify carefully with mixed content.
Privacy: runs entirely in your browser
XML payloads can contain business data; parsing and formatting happen locally in your browser and are never sent anywhere. This tool runs entirely in your browser: nothing you enter is uploaded, stored or logged on our servers, and it keeps working even if you go offline after the page has loaded.
Frequently asked questions
What does well-formed XML mean?
It follows the basic syntax rules: one root element, properly nested and closed tags, quoted attributes and escaped special characters.
What is the difference between well-formed and valid?
Well-formed is about syntax. Valid means the document also conforms to a schema (XSD or DTD) that defines allowed elements and types.
Why do I get an error about an entity?
& or < in text is illegal. Escape them as & and <, or wrap the text in CDATA.Does formatting change the data?
It only adds or removes whitespace between elements. Be careful with elements that contain mixed text and tags, where whitespace can matter.
Ratings & reviews
–
0 reviews
- 5 star
- 0 reviews (0%)
- 4 star
- 0 reviews (0%)
- 3 star
- 0 reviews (0%)
- 2 star
- 0 reviews (0%)
- 1 star
- 0 reviews (0%)
No reviews yet — be the first to share your experience.
Write a review
Reviews are moderated before they appear.
Related tools
Beautify, minify and validate JSON instantly, with exact line and column for every syntax error.
Use toolEncode text to Base64 or decode Base64 back to readable UTF-8, including URL-safe Base64.
Use toolGenerate random v4 and time-ordered v7 UUIDs in bulk, with one-click copy and format options.
Use toolTest JavaScript regular expressions live, with highlighted matches, capture groups and flag toggles.
Use toolDecode JSON Web Tokens to inspect the header, payload and expiry, all without sending the token anywhere.
Use toolConvert Unix timestamps to readable dates and back, in UTC or your local timezone, in seconds or milliseconds.
Use tool
