XML Formatter & Validator
Pretty-print, minify, and validate XML, with the parse error shown inline.
Validated and formatted live as you type. Nothing leaves your browser.
Output
Indentation
How to format and validate XML online
Paste your XML
Drop an XML document into the input. It is checked for well-formedness and reformatted automatically as you type.
Pick Pretty or Minified
Pretty produces indented, readable markup with 2 or 4 space indentation; Minified collapses the document into its most compact form.
Copy the output
A green Valid XML note with an element count confirms the document parsed, and Copy XML puts the result on your clipboard.
Why use this tool
Real errors with line info
A malformed document shows the actual parse error, typically with the line and column where parsing stopped, so mismatched or unclosed tags are quick to find.
Beautify and minify in one place
The same input pretty-prints for reading or collapses into a compact document for payloads, and switching modes reformats instantly.
Indentation control
Choose 2 or 4 space indentation in Pretty mode so the formatted markup matches your project's style.
Instant as you type
The document is re-validated and re-formatted on every edit, with a short pause between keystrokes so large files stay smooth.
Explicit validity signal
A Valid XML note with an element count appears whenever the document parses, so a quiet result never means maybe.
Enterprise payloads stay yours
Everything runs on your device. SOAP responses and config files you paste are never uploaded or retained.
About this tool
This XML formatter validates and reformats XML documents live as you type. The input is checked for well-formedness first; a document that parses is then pretty-printed with your chosen indentation or minified into its most compact form, while a document that does not parse shows the actual error, typically with the line and column where parsing stopped. That validate-before-format order means broken markup never produces half-formatted output: fix the reported line, and the formatted result appears the moment the document is well formed.
The everyday material is familiar: a build or dependency config file that broke after a hand edit, a SOAP envelope or API payload that arrived as one unreadable line, a sitemap or RSS feed you want to sanity-check before deploying, and resource or layout files that need consistent indentation before code review. Minify runs the other way, stripping the whitespace between tags so a payload embeds cleanly in a request body or a test fixture.
Nothing you paste leaves the tab, which matters when the document is an enterprise integration payload full of order data, account numbers, or internal endpoints; it is never uploaded or logged. When the response you are debugging is JSON rather than XML, the JSON formatter does the same job with the same workflow. To reshape a valid document into JSON for scripting, XML to JSON handles the conversion, and Base64 unwraps payloads that arrive encoded inside an envelope.
Frequently asked questions
- How does the XML formatter work?
- Paste or type XML into the input and it is validated and reformatted live as you type. Choose Pretty for indented, readable markup with 2 or 4 spaces, or Minified to collapse the document into its most compact form. The copy button puts the result on your clipboard.
- Does it validate against a schema or DTD?
- No. The tool checks well-formedness: every tag closed and properly nested, attributes quoted, and a single root element. It does not validate against an XSD schema or DTD, so a document can pass here and still be rejected by a schema-strict consumer.
- What happens when my XML is invalid?
- The parse error is shown inline, typically with the line and column where parsing failed, so unclosed tags and mismatched nesting are easy to track down. Your input stays untouched while you fix it, and the formatted output returns as soon as the document parses.
- When would I minify XML instead of pretty-printing it?
- Minify strips the whitespace between tags to shrink the document. That is useful for request payloads, documents embedded in code or test fixtures, and anywhere transfer size matters more than readability. Whitespace inside text content is preserved.
- What kinds of XML does it handle?
- Any well-formed XML document: config files, SOAP envelopes, sitemaps, RSS and Atom feeds, SVG markup, and plist or resource files. Declarations, comments, and CDATA sections are preserved in the output.
- Is my XML uploaded or stored anywhere?
- No. Validation and formatting happen locally in your browser, so documents never leave your device, never touch a server, and are not logged. Very large files depend on your device memory since everything runs in the tab.
Related tools
JSON Formatter & Validator
Pretty-print, minify, or explore JSON as a collapsible tree, with syntax errors shown inline.
XML to JSON
Paste XML and get JSON instantly, with attributes kept or ignored, indent control, and errors that point at the line.
API Key Generator
Generate cryptographically random API keys and tokens in hex, base62, or base64url, with control over length, an optional prefix, and bulk output.
ASCII Table Reference
The full ASCII character set with decimal, hex, octal, binary, and HTML codes. Search by code, character, or name.
Atbash Cipher
Mirror the alphabet so A swaps with Z, B with Y, and so on. Atbash is its own inverse, so one field both encodes and decodes as you type.
Base32 Encoder and Decoder
Encode text to standard Base32 and decode Base32 back to text, following RFC 4648.