XML Validator & Formatter
Validate and pretty-print XML in your browser using the DOMParser.
Loading XML Validator & Formatter… If nothing happens, please enable JavaScript.
Frequently asked questions
Is my XML sent to a server?
What is the difference between well-formed XML and valid XML?
When would I need to validate XML in practice?
How is XML different from HTML?
Does this tool validate against an XSD or DTD schema?
What is the maximum size of XML I can validate?
Does the tool work with XML namespaces?
Can I use this tool to format SVG files?
What are XML entities, and do I need to escape characters in my content?
What is a common mistake that makes XML invalid?
About XML Validator & Formatter
XML (eXtensible Markup Language) is a text-based format for storing and transporting structured data. Developed by the W3C XML Working Group and first released as a recommendation in 1998, XML was designed to be simultaneously human-readable and machine-parseable, self-describing, and extensible — meaning developers could define their own tags and document structures rather than being limited to a fixed vocabulary. XML grew directly from SGML (Standard Generalised Markup Language), the complex ISO standard used for technical documentation, but stripped away most of SGML's complexity to produce something that could be implemented in a weekend.
Despite JSON's rise to dominance for web APIs, XML remains deeply embedded in enterprise and system-level software. SOAP web services, used heavily in banking, healthcare (HL7 FHIR), and government systems, transmit XML messages. Microsoft Office documents (.docx, .xlsx) are ZIP archives of XML files. Android layout files and Maven project descriptors are XML. RSS and Atom feeds are XML. SVG images are XML. Configuration systems like Spring Framework, Hibernate, and Ant build files use XML extensively. Any developer working with legacy integrations, enterprise systems, or document formats will encounter XML regularly.
This tool validates and formats XML entirely inside your browser using the browser's built-in DOMParser API — the same engine that renders HTML pages. It parses your input and reports the first well-formedness error with the line and column number so you can pinpoint problems instantly. Valid XML is then re-serialised with consistent indentation to produce a clean, readable output. Because all processing happens locally, your XML documents — which may contain proprietary schemas, credentials in configuration files, or sensitive business data — are never uploaded to any server.
XML is stricter than HTML in important ways that trip up developers new to the format. Every element must be properly closed (unlike HTML, which tolerates unclosed tags). Attribute values must always be quoted. The document must have exactly one root element. The five predefined entity references (&, <, >, ', ") must be used for the corresponding literal characters inside text and attribute values. XML is also case-sensitive: <Tag> and <tag> are different elements. Well-formedness (correct syntax) is a separate concept from validity (conformance to a schema such as XSD or DTD), and this tool checks only the former.
XML and the quest for a universal document format
XML grew out of a decade-long effort to tame SGML (Standard Generalised Markup Language), a powerful but enormously complex ISO standard originally designed for technical documentation at the US Department of Defense. SGML was so intricate that only specialised software could process it. In 1996, a W3C working group led by Jon Bosak set out to create a simplified 10 % of SGML that would cover 90 % of the use cases — and do so in a form that could be implemented in a weekend rather than years. XML 1.0 became a W3C Recommendation on February 10, 1998.
The late 1990s and early 2000s were peak XML enthusiasm. Technologists envisioned XML as the universal glue of the internet: documents, data, configuration, messaging, and even programming would all be XML. Web services would use SOAP (Simple Object Access Protocol) envelopes of XML. Applications would describe their interfaces in WSDL (Web Services Description Language), itself an XML dialect. The 'angle-bracket tax' — the verbosity of XML syntax — was seen as a worthwhile price for universal interoperability.
The backlash came with JSON's rise in the mid-2000s. JSON's compactness and direct mapping to JavaScript objects made it dramatically simpler for web API use cases, and it rapidly displaced XML in that domain. Yet XML never disappeared. It remains the dominant format in enterprise integration, document formats (ODF, OOXML), configuration systems, and anywhere that schemas, namespaces, and the ability to mix document and data are genuinely valuable. The W3C's XSLT transformation language and XPath query language — both XML-based — have no real JSON equivalents for complex document transformation tasks.