What indentation widths does the XML formatter support?
Three options: 2 spaces (the most common convention for SOAP, RSS, and Atom), 4 spaces (often used in Java and .NET XML configuration), and tab characters. Pick the option that matches your team style guide before clicking Format — the formatter applies it to every nesting level.
Does the formatter convert empty elements to self-closing tags?
Yes. Any element with no children and no text content is emitted as a self-closing tag (e.g. <empty/>) rather than an open/close pair (<empty></empty>). This matches the canonical XML serialization rule and reduces file size without changing the document semantics.
Is attribute order preserved during formatting?
Yes. The formatter walks the parsed DOM in document order and emits each element's attributes in the order they appeared in the source XML. Attribute names and quote characters are kept exactly as parsed — the formatter does not re-sort or alphabetize them.
What gets normalized and what stays untouched?
Normalized: whitespace between elements, indentation depth, blank lines, and the layout of mixed-content nodes. Untouched: attribute values, text content (the actual characters inside an element), CDATA sections, processing instructions, and namespace declarations.
Will formatting damage XML with mixed content?
Mixed content (an element containing both text and child elements, like XHTML paragraphs) is the trickiest case. The formatter detects elements with significant text content and keeps the original layout for those nodes — it only re-indents around elements whose children are purely structural.
Does the formatter preserve XML namespaces and prefixes?
Yes. xmlns and prefixed declarations (e.g. xmlns:soap="...") are emitted verbatim on the elements where they appear, and prefixed element/attribute names (soap:Body, xsi:type) are kept intact through formatting.
Is my XML uploaded to your servers?
No. The formatter uses the browser's built-in DOMParser and a JavaScript serializer running on your machine. SOAP envelopes containing tokens, signed payloads, or proprietary business data never leave your device. Verify in DevTools → Network: clicking Format produces zero requests.
How is this different from XML Pretty Print on this site?
Functionally they are the same operation — both indent XML for readability. The Formatter page is the canonical tool with the full feature set; the Pretty Print page exists because that phrasing is more common in some communities. If you came here looking for "pretty print", you are in the right place.