XML Formatter
This XML formatter pretty-prints, validates, and minifies XML in your browser. It checks that tags are well formed, points to the line of the first error, and indents with 2 spaces, 4 spaces, or tabs.
How to use
- Paste XML into the box, or drop an XML file onto it.
- Choose 2 spaces, 4 spaces, or tabs.
- Click Format to re-indent every nested element, or Minify to strip whitespace between tags.
- Copy or download the result. If the XML is not well formed, the line of the first error is shown.
How it works
Format parses the document and checks matching tags, quoted attributes, and a single root element, then reprints each nested element at the indent you chose. Minify removes whitespace between tags and writes one compact line. Text inside a tag is kept. The check is well-formedness only and does not validate against an XSD schema. Nothing is uploaded.
Example. The markup <note><to>Sam</to></note> with 2-space indent prints note, then to on the next line indented two spaces with the text Sam, then the closing note tag.
Well-formed, not a schema
The check looks for matching tags, quoted attributes, and one root element, then shows the line of the first problem. It does not validate against an XSD schema. Parsing stays in your browser.
Frequently asked questions
How do I format XML online?
Paste your XML into the box and click Format. The tool re-indents every nested element and shows the cleaned result you can copy or download.
Does this validate my XML?
It checks that the XML is well formed (matching tags, quoted attributes, one root element) and shows the line of the first error. It does not validate against an XSD schema.
Is my XML uploaded to a server?
No. Parsing and formatting happen in your browser, so private config files never leave your device.
Can I minify XML too?
Yes. Switch to Minify to strip whitespace between tags and produce a single compact line.
What indentation options are there?
You can choose 2 spaces, 4 spaces, or tabs.
Related tools
- DevJSON Formatterin-browser JSON pretty-printer, minifier, and syntax validator.
- DevBase64 Decoder & EncoderDecode or encode Base64 text in the browser, with UTF-8 and URL-safe support.
- DevRegex TesterTest JavaScript regular expressions with live match highlighting.
- DevSubnet CalculatorCIDR to netmask, hosts, network, and broadcast for IPv4.
- DevBarcode GeneratorEncode a SKU or number as Code 128, Code 39, EAN-13, or UPC-A and download PNG or SVG.
- DevUPC GeneratorBuild a valid UPC-A barcode digit string with check digit.