XML Formatter
Format, validate, and pretty-print XML documents instantly.
What is XML and when is it used?
XML (eXtensible Markup Language) is a markup language designed to store and transport data in a format that is both human-readable and machine-readable. Unlike HTML, which has a fixed set of tags, XML allows you to define your own tags, making it a flexible format for representing virtually any hierarchical data structure. XML was standardised by the W3C in 1998 and became the dominant data interchange format for enterprise systems in the 2000s, before JSON largely replaced it for web APIs.
XML remains widely used in enterprise and legacy systems: SOAP web services, RSS and Atom feeds, Office Open XML (.docx, .xlsx), Android resource files, Maven and Ant build configurations, XHTML, SVG graphics, and configuration files for Java EE applications. If you work with any of these technologies, XML formatting and validation tools are essential.
A well-formed XML document has a single root element, all tags are properly closed, attribute values are quoted, and special characters (<, >, &, ", ') are escaped as entity references. A valid XML document is additionally valid against a DTD or XML Schema (XSD). This tool checks for well-formedness; full schema validation requires a server-side tool.
Common mistakes
- Character encoding — XML defaults to UTF-8 but the declaration
<?xml version="1.0" encoding="ISO-8859-1"?>can specify another encoding. Sending UTF-8 content with an ISO-8859-1 declaration (or vice versa) causes parse errors on non-ASCII characters. - Unescaped characters — The characters
<,>,&,", and'are reserved in XML content and must be written as<,>,&,", and'respectively.