XML Formatter
Format or minify XML. Validates syntax using the browser parser, self-closes empty elements, and shows element/attribute stats.
Mode
Indent
Examples:
XML input✓ Valid XML
Formatted output
What is XML?
XML (eXtensible Markup Language) is a markup language for encoding documents in a format that is both human-readable and machine-readable. It is widely used for configuration files (Maven pom.xml, Android layouts), data interchange (SOAP, RSS, Atom feeds), and document formats (SVG, XHTML, Office Open XML).
XML vs JSON — When to Use Each
Use XML when you need: document structure with mixed content, namespaces, schema validation (XSD), XSLT transformations, or SOAP web services.
Use JSON when you need: lightweight data interchange, REST APIs, JavaScript-native parsing, or simpler key-value structures.
Common XML Formatting Rules
- Every opening tag must have a matching closing tag (or be self-closing)
- Tags are case-sensitive —
<Name>and<name>are different elements - Attribute values must be quoted (single or double quotes)
- Special characters must be escaped:
<>&"' - A well-formed document has exactly one root element