A free online XML formatter for beautifying, minifying, and validating XML in one place. Paste your code to apply clean indentation, create compact output, or check for structural errors in your browser.
| Operation | Input Size | Output Size | Compression | Lines (Before → After) |
|---|---|---|---|---|
| Format (compact → readable) | 1.2 KB | 1.8 KB | −50.0% (increase) | 1 → 45 |
| Minify (readable → compact) | 1.8 KB | 1.1 KB | +38.9% | 45 → 1 |
| Format (API response) | 4.5 KB | 6.2 KB | −37.8% (increase) | 3 → 120 |
| Minify (sitemap.xml) | 12.0 KB | 8.1 KB | +32.5% | 350 → 1 |
| Validate (error detection) | 2.3 KB | — | — | Errors: 3 (line 12, 34, 67) |
Well-formed vs. valid XML: This tool checks for well-formedness — matching tags, proper nesting, and valid syntax. It does not validate against external schemas (DTD/XSD). A well-formed document is syntactically correct; a valid document also conforms to a specific schema.
Batch processing: To format or minify multiple XML files at once, use the XML Batch Formatter for multi-file processing.
Use the stats panel: The statistics cards below the editors show original vs. processed size, line counts, and compression rate — useful for measuring file size reduction after minification.
Browser-side processing: XML formatting, minifying, and validation run in your browser via JavaScript.
Paste your XML into the input editor and click Format. The tool rewrites the markup using consistent 4-space indentation and line breaks that reflect the nesting depth of each element. Tag names, attributes, and text content are preserved without changes.
The validator checks your document for well-formedness — unclosed tags, mismatched opening and closing pairs, missing or malformed XML declarations, duplicate attributes, and improper nesting. Each detected issue is reported with its line number and a brief explanation so you can locate and fix errors.
Click Minify to strip all whitespace between tags, producing a compact single-line document. Text content inside elements is preserved. The stats panel displays the compression rate so you can see the size reduction — typically 30–40% for common configuration files and data feeds.
A well-formed document follows basic XML syntax rules: every opening tag has a matching closing tag, attributes are quoted, elements are properly nested, and there is exactly one root element. A valid document additionally conforms to a defined schema such as a DTD or XSD. This tool checks for well-formedness; schema validation is not included.
No. Formatting, minifying, and validation are performed by JavaScript running in your browser. The XML you paste into the editor is processed on the page rather than sent to a server.
This free online XML formatter lets you beautify, minify, and validate XML directly in your browser. Paste your code to debug a minified API response, standardize a configuration file for code review, or create a compact sitemap.xml file.
Both the input and output editors are powered by CodeMirror, with syntax highlighting, line numbers, and bracket matching. A built-in validator checks your document for well-formedness and reports unclosed tags, mismatched pairs, and missing declarations with line-numbered errors. Formatting, minifying, and validation run in your browser via JavaScript.
Use it for XML configuration files, sitemap.xml payloads, data feeds, and XML structure lessons when you need readable formatting, compact output, or well-formedness checks without installing desktop software.
| Concept | Description | Example |
|---|---|---|
| XML Declaration | Optional first line specifying version and encoding | <?xml version="1.0" encoding="UTF-8"?> |
| Root Element | Exactly one element that contains all others | <catalog>...</catalog> |
| Child Elements | Nested elements inside the root or other elements | <book><title>...</title></book> |
| Attributes | Name-value pairs inside opening tags | <book category="web"> |
| Self-closing Tags | Elements without content, closed with /> | <break fast="true"/> |
| Comments | Ignored by parsers, used for documentation | <!-- Note: --> |
| CDATA Sections | Blocks of text not parsed as XML markup | <![CDATA[<raw>text</raw>]]> |