XML formatter and validator
Format or minify strict XML without changing namespaces, mixed content, CDATA, or preserved whitespace.
- SECURE
- NO UPLOADS
- NO SIGNUP
- BROWSER BASED
- FREE
- FOREVER.
Support us with a link or a share
An XML formatter cannot treat XML like forgiving HTML
XML requires one well-formed tree. Element and attribute names are case-sensitive, every opened element must close correctly, quoted values must remain quoted, and namespace prefixes carry identity rather than styling. A browser rendering HTML repairs many errors by design. An XML formatter must not. This page validates first and returns no transformed output when the source is malformed.
The error keeps the original source in place and identifies the line and column. Fixing the source remains your decision; the tool does not invent a closing tag, move a child, rename a prefix, or drop an unknown node to make parsing succeed. If the document is actually HTML, use the HTML formatter and minifier. Its void-element, whitespace, and fault-recovery contract is intentionally different.
Indentation can become text
Pretty printing sounds like adding line breaks and spaces between tags. In mixed content,
those characters may be visible data. An element containing text, emphasis, and more text
cannot receive a newline around its child without changing the sentence. The same is
explicit under xml:space="preserve", where whitespace is part of the contract.
Those regions are protected rather than made visually tidy at the cost of meaning.
Choose two spaces, four spaces, or tabs for structural indentation. The minify option removes representation whitespace only where it is safe to do so. Comments, processing instructions, CDATA, namespace declarations, attribute values, and significant text remain semantically intact. Before and after byte counts describe the actual result, not an estimated saving. The receipt also names the detected root and element count, giving a quick structural cross-check without pretending to validate an application-specific schema.
DOCTYPE and external entities stop before transformation
A DTD can define entities locally or point to another resource. Resolving it safely requires an explicit network and local-file policy, and expanding nested entities can consume enormous resources from a very small source. This local formatter does not need either capability. A document containing DOCTYPE or external entity declarations is rejected before formatting or preview, with the original preserved.
That conservative boundary is also why XML-to-JSON is not a switch on this page. Attributes, repeated sibling names, element order, namespaces, CDATA, and mixed text have no universal JSON representation. Any converter that promises one must choose a mapping schema. The JSON formatter formats data that is already JSON; it does not pretend the two document models are interchangeable.
Paste, open, copy, or download the complete document
Type or paste XML into the source area, or open a local .xml or text file. The
result appears separately so changing indentation or minification never overwrites the input.
Long output may be clipped on screen to keep the page responsive, but copy and download use
the complete string. To review structural changes between two versions, use the
text comparison tool after formatting both with the same settings.
Parsing and transformation run in this browser tab. XML frequently contains configuration, internal endpoints, identifiers, or customer exports, so no source is placed in the address bar, browser storage, analytics, or a remote formatter. Large documents receive memory advice and local Worker processing without an arbitrary file-size refusal. The verification guide explains how to confirm the network boundary yourself.
Questions
Is XML formatting the same as HTML formatting?
No. XML is case-sensitive, requires well-formed nesting and closing tags, and gives namespaces and whitespace explicit meaning. HTML uses a fault-tolerant parser with different rules, so it remains a separate formatter.
Will formatting change mixed text content?
No. Whitespace between inline text and child elements can be data, so mixed-content regions and xml:space="preserve" are protected. The formatter does not insert indentation where it would create text.
Does it resolve a DTD or external entity?
No. DOCTYPE and external entities are rejected before transformation. Resolving them would require a network or local-file policy and could change the document outside the bytes you submitted.
Can it convert XML to JSON?
No. Attributes, repeated elements, namespaces, order, CDATA and mixed content have no universal JSON mapping. A converter needs an explicit schema or mapping policy; this route keeps XML as XML.
Is the XML uploaded?
No. File reading, parsing, formatting, minification and result generation run locally in this browser tab. The source is not stored or logged.