Beautify and validate XML with the exact error line, minify it, or convert XML to JSON - in your browser.
Last updated:
Works with SOAP responses, RSS feeds, sitemaps, SVG, Android layouts and .config files.
| Button | What it does | Also searched as |
|---|---|---|
| Format / Beautify | Indents nested elements | xml pretty print, xml beautifier, xml viewer |
| Validate | Checks the XML is well-formed | xml validator, xml checker, xml lint |
| Minify | Removes whitespace and comments | xml minifier, compress xml |
| XML → JSON | Turns XML into JSON | xml to json converter |
| Error | Cause | Fix |
|---|---|---|
| Opening and ending tag mismatch | <a></b> | Close tags in the right order |
| Unescaped & | Tom & Jerry | Write & |
| Unescaped < | 5 < 6 in text | Write < or use CDATA |
| Extra content at the end | Two root elements | Wrap everything in one root |
| Attribute without quotes | id=5 | Use id="5" |
| Text before the declaration | Space before <?xml | The declaration must be first |
| XML | JSON |
|---|---|
| <name>Sam</name> | "name": "Sam" |
| <price currency="USD">9</price> | "price": {"@currency": "USD", "#text": "9"} |
| Repeated <book> elements | "book": [ {...}, {...} ] |
| Empty <tag/> | "tag": "" |
| Where | How |
|---|---|
| Linux / Mac | xmllint --format file.xml |
| Python | xml.dom.minidom.parseString(s).toprettyxml() |
| VS Code | XML extension → Shift + Alt + F |
| Notepad++ | XML Tools plugin → Pretty print |
| File | What it is |
|---|---|
| sitemap.xml | Lists your pages for Google and Bing |
| RSS / Atom feed | Blog and podcast updates |
| SOAP response | Older enterprise and bank APIs |
| pom.xml | Maven build file (Java) |
| AndroidManifest.xml | Android app settings |
| .svg | Vector images are XML |
| web.config | IIS / .NET settings |
Paste it above and press Format / Beautify. Choose 2 spaces, 4 spaces or tabs.
Press Validate. Errors show with the line and column, and the line is highlighted.
No. It checks that the XML is well-formed. Schema (XSD/DTD) validation needs a server-side tool.
Press XML → JSON. Attributes become @name keys and repeated elements become arrays.
Yes - they are all XML.
No. It is processed in your browser.
No. Only whitespace between tags changes; values, attributes, comments and CDATA are kept.
Press Minify to remove whitespace between tags and comments.