XML Formatter & Viewer
Format, beautify, and validate XML with syntax highlighting, tree view toggle, and minification
XML Formatter & Viewer
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="web">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
<description>A comprehensive guide to XML fundamentals, including namespaces, schemas, and transformations.</description>
</book>
</bookstore>Features
Automatically indent and format XML with configurable spacing (2, 4, or tab).
Remove unnecessary whitespace and compress XML to a single line for production.
Color-coded tags, attributes, values, comments, and CDATA sections for easy reading.
Visualize XML structure as a color-coded, hierarchical tree view.
Updated . Provided as is. Check the output before you rely on it in production.
How to use XML Formatter & Viewer
- 1
Paste your XML
Paste minified, broken or formatted XML into the input, or load the sample.
- 2
View formatted output
Formatted XML appears in the right panel with syntax highlighting. Switch to Tree view to see the nested structure. Errors show with line numbers.
- 3
Choose indentation or minify
Set the indent width, or switch on Minify to compress the XML onto a single line.
- 4
Copy or download output
Copy the result, or download the formatted XML file for your project.
Questions and answers
What is XML Formatter & Viewer?
Does XML Formatter & Viewer store or send my data?
Can XML Formatter & Viewer minify XML?
Use it as an API
XML Formatter & Viewer is also callable as a free HTTP JSON API at
https://aidevhub.io/api/xml-formatter/ — GET with query
parameters or POST with a JSON body, no authentication, CORS enabled, fair use
(abusive traffic is throttled at the edge; there is no per-request quota header). Responses return
{ ok, tool, result, meta }.
curl -s -X POST https://aidevhub.io/api/xml-formatter/ \
-H "Content-Type: application/json" \
-d '{"xml":"<root><item id=\"1\">alpha</item><item id=\"2\">beta</item></root>","mode":"format"}' Machine-readable contract: /api/tool/xml-formatter.json All API endpoints: /agents/ LLM site index: /llms.txt
For AI agents: how to call this tool
Machine-readable contract, endpoints and examples. Humans can ignore this section.
Best Path For Builders
Dedicated API endpoint
Deterministic outputs, machine-safe contracts, and production-ready examples.
Dedicated API
https://aidevhub.io/api/xml-formatter/ OpenAPI: https://aidevhub.io/api/openapi.yaml