Format and validate XML documents instantly — beautify minified XML, check for structural errors and minify for production with proper indentation.
Enter your figures and click Calculate to see your results.
Paste your XML document, select format, minify or validate, then choose the indent size for the output.
Click the Format button. Your code is processed instantly — all formatting runs in your browser with no data sent to servers.
The formatted output appears on the right. Click Copy to grab it, or Download to save as a file. Statistics like size reduction and line count are shown automatically.
XML (Extensible Markup Language) is a markup language for encoding documents in a human-readable and machine-readable format. Today it is used in: SOAP web services, RSS and Atom feeds, SVG (vector graphics), Microsoft Office formats (.docx, .xlsx are ZIP files containing XML), Android layouts, Maven build files, configuration files (Spring, Hibernate), and many enterprise systems that predate JSON-based APIs.
While both use angle-bracket tags, XML is stricter than HTML: all tags must be explicitly closed (or self-closing), attribute values must be quoted, tags are case-sensitive, there can only be one root element, and you can define your own tags (XML is extensible, hence the name). HTML5 parsers are very permissive and forgive many errors; XML parsers reject any malformed input.
XML namespaces prevent naming conflicts when combining XML from different vocabularies. Declared with xmlns: prefix="URI", e.g. xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/". The URI is an identifier (not necessarily a real URL). SOAP envelopes, XHTML, SVG and many other XML vocabularies use namespaces. A correctly formatted XML formatter preserves namespace declarations.
JSON is more compact (typically 30–40% smaller for equivalent data), easier to parse in JavaScript, more readable, and natively supported in browsers. XML supports attributes (additional metadata on elements), mixed content, comments, and is more self-documenting. New REST APIs almost universally use JSON; SOAP services and many enterprise integration platforms use XML. Some APIs support both via content-type negotiation.
XPath is a query language for navigating XML documents. It uses path expressions to select nodes: /root/child selects all child elements of root; //user selects all user elements anywhere; @id selects the id attribute; user[@active='true'] selects users with active="true". XPath is used in XSLT transformations, Selenium test selectors, and XML parsing libraries in most programming languages.
XSLT (Extensible Stylesheet Language Transformations) transforms XML documents into other XML, HTML or plain text. An XSLT stylesheet defines rules that match XML patterns and produce output. For example, XSLT can transform raw XML data into an HTML table, or convert one XML schema to another. Though less common than it once was, XSLT remains important in document publishing, data migration and legacy system integration.
Processing instructions (PIs) in XML communicate application-specific instructions that are not part of the document's character data: <?xml version="1.0" encoding="UTF-8"?> is the most common. PIs have the format <?target instruction?> where target identifies the application to which the PI is directed. Browsers use <?xml-stylesheet?> to apply CSS or XSLT to XML documents.
Common XML errors: unclosed tags (every opening tag needs a matching close tag), overlapping tags (<a><b></a></b> — tags must nest properly), missing root element (XML must have exactly one root), unescaped special characters (use & for &, < for <, > for >, " for ", ' for '). This formatter detects and reports the exact location of any structural error.