JSON Formatter & Validator
Format and validate JSON syntax — the sibling tool for JSON APIs, config files, and log payloads.
Open toolHome › Tools › Developer Tools › XML Formatter
Paste any XML to instantly format it with readable indentation or minify it to one line. Parse errors show the exact line and what went wrong. 100% in-browser — nothing leaves your device.
DOMParser API. Your data is never uploaded or stored.
XML Formatter & Validator parses and rebuilds any XML document in your browser using the native DOMParser API — no uploads, no server round-trips, no third-party libraries.
How it works
Paste your XML and click Format (or press Ctrl+Enter). The formatter passes the raw string to DOMParser with the application/xml MIME type, which triggers a strict parser built into every modern browser since 2010. If the document is well-formed, the formatter walks the DOM tree recursively, reconstructing the element hierarchy with consistent two-space indentation at every nesting level. Attributes are preserved in their original order; namespace declarations like xmlns and xmlns:prefix are carried through verbatim because the DOMParser makes them explicit in the attribute list.
If the document has an error, the formatter extracts the exact line number and column from the DOMParser's error output and translates cryptic browser messages into plain English — for example, “Attribute is missing a value” instead of the raw “Specification mandate value for attribute.”
Format vs. Minify
The Format mode re-indents the document for reading. The Minify mode strips all inter-element whitespace into a single line — the right choice when you need the smallest possible payload for an HTTP request body, a config diff, or a version-control snapshot where whitespace changes add noise.
What you can use it for
pom.xml or build.xml before committing to check for unclosed tags and verify namespace declarations.What it does not do
The formatter checks that your XML is well-formed — correct tag nesting, valid attribute syntax, a single root element. It does not validate against an XSD schema. XML that passes here is structurally correct but not necessarily schema-valid.
There is no server-side file size limit because all processing runs locally in your browser tab. Very large documents (over 5 MB) may take a moment depending on your device.
No — it checks that the XML is well-formed (correct tag nesting, valid attribute syntax, single root element) using the browser's native DOMParser. XSD schema validation is out of scope for this tool.
The DOMParser makes implicit namespaces explicit when rebuilding the tree. The namespace declarations were always present in your document — they're now visible in the output. The XML is correct and equivalent to the original.
The XML declaration is part of the document prolog, not the element tree. The DOMParser doesn't surface it in the DOM, so the serializer can't include it. The output starts with the root element — the content is fully preserved.
No hard limit — all processing runs in your browser. Very large documents (over 5 MB) may take a moment, but there's no server-side cap.
HTML is not XML. The tool uses the strict XML parser, which requires well-formedness — unclosed tags and bare & or < characters that browsers silently accept in HTML will cause parse errors here. Use a dedicated HTML formatter for HTML files.
Keep going
Format and validate JSON syntax — the sibling tool for JSON APIs, config files, and log payloads.
Open toolConvert JSON configs and API responses to YAML in one paste — no signup, no install.
Open toolEncode XML payloads as Base64 for API transport — or decode a Base64 string back to readable text.
Open toolTest regex patterns against XML attribute values or element content before writing schema validation code.
Open tool