XML Formatter — Guide
Prettify or minify your XML string — human-readable indentation, or strip it back down to a single line.
What it is and when to use it
Turn a cramped XML string into readable, indented markup — or strip it back down when you need the compact form. Well-formed XML is validated as part of processing, so a misplaced tag surfaces immediately instead of exploding somewhere downstream in your SOAP response or Android layout.
Formats XML that has been compressed onto one line into an indented structure — very useful when reading API payloads.
How to use it
- Paste the XML
- Click format
- Copy the result
A worked example
Fill in sample XML
<root><user id="1"><name>Alice</name></user></root>
Copy this into the tool, or open XML Formatter
Questions people ask
- Does formatting validate my XML?
- Partially: the parser must read your XML successfully, so broken nesting, unclosed tags and bad entities fail loudly here. It is not a schema (XSD) validator — structure rules beyond well-formedness need a dedicated tool.
- Why is my indented XML suddenly bigger?
- Pretty-printing adds whitespace text nodes, which matter in XML: an element containing " text " is not the same as one containing "text". That is why round-tripping through minify can alter content-sensitive documents.
- What about namespaces and attributes?
- Namespaces are preserved exactly — formatting only re-arranges whitespace between tags, never renames elements or touches attribute values.
Next steps
Spotted something wrong on this page? Tell us via Contact Us