๐ Runs in your browser โ nothing is uploadedโ Free, no signup
XML Formatter & Validator
Paste XML to format it with clean indentation, check that it's well-formed, or minify it. Errors show the exact line and column so you can fix them fast.
0 characters
Formatted XML
When should you use the XML Formatter?
- Reading minified XML from an API, SOAP response or config file
- Finding the broken tag in an XML document that won't parse
- Shrinking XML before sending or storing it
How to use the XML Formatter
- 1
Paste your XML
Paste a document or snippet into the input editor, or click Load sample.
- 2
Choose Format or Minify
Format adds indentation and line breaks. Minify removes the whitespace between tags.
- 3
Check validation
If the XML isn't well-formed you'll see the line, column and reason. Fix it and the output updates.
- 4
Copy or download
Copy the result or download it as an .xml file.
Examples
Minified XML to readable XML
Before
<catalog><book id="1"><title>XML Guide</title><price>44.95</price></book></catalog>
After
<catalog>
<book id="1">
<title>XML Guide</title>
<price>44.95</price>
</book>
</catalog>Common errors and how to fix them
Expected closing tag 'b' instead of closing tag 'a'- Tags are closed in the wrong order or one is missing. Every opening tag needs a matching closing tag, and inner tags must close before outer ones.
Invalid character or unescaped &- Write & as & and < as < inside text and attribute values.
Multiple root elements- An XML document must have exactly one top-level element. Wrap everything in a single parent element.
More from Code Formatters & Minifiers
Free tools that run in your browser โ no signup, nothing uploaded.
SQL Formatter & Beautifier
Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more.
CSS Minifier & Compressor
Optimize CSS by removing whitespace and comments to accelerate page load time.
JS Minifier & Compressor
Compress JavaScript to improve website speed and performance.
HTML Formatter & Beautifier
Beautify or minify HTML with clean, consistent indentation.
Markdown Editor & Preview
Write Markdown with a live preview and copy the HTML.
HTML to JSX Converter
Convert HTML to valid React JSX โ className, style objects and more.
SVG to React Component
Turn SVG markup into a React component with camelCase attributes.
HTML to Markdown Converter
Convert HTML to clean Markdown, including tables and code blocks.
GraphQL Formatter
Format GraphQL queries, mutations and schemas with Prettier.
XML Formatter FAQ
It adds consistent indentation and line breaks so each element sits on its own line at the right depth. The data itself doesn't change โ only whitespace between tags.
Yes. Every input is checked for well-formedness โ matching tags, a single root element, quoted attributes and valid characters. Errors show the line and column. It does not validate against an XSD or DTD schema.
Yes. Comments, CDATA sections, processing instructions and the <?xml?> declaration are preserved. When minifying you can choose to remove comments.
Leading and trailing whitespace around text is trimmed so it lines up neatly. If whitespace inside an element is meaningful to your application, check the result before using it.
XML is a strict data format: every tag must be closed and names are case-sensitive. HTML is for web pages and is more forgiving. Use the HTML Formatter for HTML.
No. Formatting and validation run in your browser, so it's safe to paste internal API responses and config files.
