XML Formatter

Pretty-print, minify, and validate XML on the spot — check for well-formedness errors instantly. Also handy for inspecting SOAP/REST API responses and RSS/Atom feeds.

Tips

  • Everything you type is processed entirely in your browser with JavaScript — nothing is ever sent to toolbase.cc's servers, so it's safe to format internal config files or responses containing sensitive data.
  • Turning on minify mode strips all whitespace and line breaks between tags, which is handy for embedding XML into config files or shrinking an HTTP request body.
  • If the output shows "Invalid XML," it's usually caused by an unclosed tag or a mismatch between an opening and closing tag name. Use the line number shown in the error list to track down the problem.
  • This tool is a sibling of the JSON and SQL formatters, built on the same approach. If your API returns both JSON and XML, pairing this with the JSON Formatter can speed up debugging.
  • Tag matching also accounts for namespace prefixes (e.g. <soap:Envelope>), so this works well for debugging SOAP messages too.

Frequently asked questions

It means every opening tag has a matching closing tag and elements are nested correctly with no overlapping. Being well-formed is a mandatory requirement of the XML spec — a parser will throw an error and refuse to load XML that isn't. This is a separate concept from "valid," which refers to conforming to a schema (DTD/XML Schema).

For a brand-new web API, JSON is usually lighter and easier to work with. But in domains where XML is the established standard — SOAP integrations, RSS/Atom feeds, SVG, and many existing enterprise systems — you'll still need XML. In practice, the right choice depends on the ecosystem you're integrating with.

The parser will misinterpret it as part of a tag, which triggers a well-formedness error. Inside attribute values and text nodes, these characters must be escaped as entity references, e.g. &lt; and &amp;.

No. This tool's minify mode only strips whitespace and line breaks between tags — it leaves comments and CDATA section contents untouched. If you want comments gone entirely, you'll need to remove them manually.

Yes. Tag names with namespace prefixes, like <ns:tag>, are matched including the prefix, so this validates and formats correctly even for namespace-heavy XML such as SOAP messages.
ツールくん

Side Note — XML, the offspring of SGML

XML (Extensible Markup Language) became a W3C recommendation in 1998, and its lineage traces back to SGML (Standard Generalized Markup Language), a sprawling document-description standard from the 1980s — XML was designed as a simplified subset of it. HTML is another SGML application, making XML and HTML siblings in the same family.

In the early 2000s, XML spread rapidly as the standard format for web APIs and business-to-business data exchange (EDI), led by SOAP. Its support for attributes, namespaces, and strict typing via XML Schema made it well suited to enterprise use cases of the era.

By the 2010s, JSON had taken over as the dominant format, but XML never disappeared. It remains the standard in domains that need rich structured-document expressiveness: RSS/Atom feeds, SVG images, the internal formats of Office documents (docx/xlsx), and Android layout files, to name a few.

This tool is the third in Toolbase's formatter lineup, following the JSON and SQL formatters — together they round out the three major data formats developers work with day to day.

→ Browse all trivia