XML Formatter
Pretty-print messy XML, squeeze it onto one line, or find out exactly where it breaks. Paste XML or open a file such as an RSS feed, SVG or config.
Comments, CDATA sections and attribute quoting are kept as written. Elements that contain text stay on one line, so no text or spacing inside them changes.
How to format XML
- Paste XML or open an .xml file.
- Choose Format or Minify and the indent.
- Fix any error shown with its line and column, then copy or save the result.
Features
- Format with 2 spaces, 4 spaces or tabs
- Minify to one line
- Errors with line and column
- Keeps comments, CDATA and DOCTYPE
- Open and save .xml files
- Works with SVG, RSS, sitemaps and configs
Frequently asked questions
Why does it say my XML is invalid?
Common causes are a closing tag that does not match its opening tag, an unescaped & or < in text, an attribute without quotes, or more than one root element. The message gives the line and column to look at.
Are comments and CDATA kept?
Yes. Comments, CDATA sections, processing instructions and the DOCTYPE stay exactly as written. Tick “Remove comments” to drop comments.
Will formatting change my data?
Elements that contain text are kept on one line with their text untouched, so values and mixed content such as <p>Hello <b>there</b></p> do not change. Only whitespace between tags is adjusted.
Can it handle large files?
Yes. A 5 MB file formats in about a second because nothing is uploaded.
Is my data sent to a server?
No. Everything runs in your browser, so configs, API responses and code never leave your device.
Related tools
All Developer Tools →- XML to JSON Convert XML documents, feeds and SOAP responses to JSON.
- JSON Formatter Pretty-print messy JSON, find syntax errors fast, or minify it for production.
- Code Beautifier Make minified or badly indented code readable again.
- JSON to TypeScript Turn a sample API response or config into TypeScript types you can paste into your project.
- IP Subnet Calculator Type an IP address with a prefix such as 192.168.10.37/24 to see its network details, a binary view and how to split it into smaller subnets.
- HTML, CSS & JS Playground Try out an idea, teach a concept or debug a snippet without setting up a project.