# XML Formatter

URL: https://phishdestroy.io/developer-tools/xml-formatter
Category: General dev
Where it runs: Runs locally (nothing you enter is uploaded)

Pretty-print or minify an XML document such as a sitemap, an RSS feed or an SVG file; malformed XML is reported with the parser error message.

## Example input

One-line sitemap

```
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://example.com/</loc><priority>0.8</priority></url></urlset>
```

The XML declaration stays on the first line, and the url, loc and priority elements are indented by two spaces per level.

## FAQ

### Does it validate against a schema?

No. It checks that the document is well-formed (tags closed and nested correctly, one root element, attribute values quoted) using the browser's DOMParser. DTDs and XSD schemas are not checked.

### Can formatting change the document?

Whitespace between tags is removed and replaced by new indentation, which matters for mixed content and xml:space="preserve". Comments, a DOCTYPE or CDATA sections also push the indentation of the following lines one level to the right.

### Is the XML uploaded?

No. Parsing and formatting run in your browser, and the document is not sent anywhere.

## Related tools

- [JSON Formatter](https://phishdestroy.io/developer-tools/json-formatter)
- [YAML Formatter](https://phishdestroy.io/developer-tools/yaml-formatter)
- [SQL Formatter](https://phishdestroy.io/developer-tools/sql-formatter)
- [Sitemap XML Generator](https://phishdestroy.io/developer-tools/sitemap-xml-generator)
- [HTML Attachment Analyzer](https://phishdestroy.io/developer-tools/html-attachment-analyzer)

All tools: https://phishdestroy.io/developer-tools
