XML Formatter & Viewer
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.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Programmatic Access
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,
50 requests/day per IP. 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
Agent Invocation
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
Unified Runtime API
https://aidevhub.io/api/tools/run/?toolId=xml-formatter&a=...
GET and POST are supported at /api/tools/run/ with identical validation and limits.
Limit: 30 req / 60s, input max 256 KB.
How to Use XML Formatter & Viewer
- 1
Paste your XML
Copy your XML code into the textarea (minified, broken, or formatted). The tool immediately validates and formats it. Click 'Sample' for example XML.
- 2
View formatted output
Formatted XML appears in the right panel with syntax highlighting. Switch to Tree View to see nested structure visually. Errors show with line numbers.
- 3
Format and validate
Click 'Format' to beautify the XML. The validator will highlight syntax errors like unclosed tags, invalid characters, or malformed attributes.
- 4
Copy or download output
Use 'Copy to clipboard' for quick sharing, or download the formatted XML file for integration into your project.