# XML Formatter

Pretty-print and minify XML.

## URL

https://ilham.dev/tools/xml-formatter/

## What It Does

Pretty-print or minify XML at the indentation you choose. It parses the document first, so mismatched and unclosed tags are reported instead of being passed through.

## Features

- Runs in the browser
- No login required

## Input

text input.

## Output

text output.

## Privacy

Processing happens locally in the browser.

No input data is uploaded to ilham.dev.

- Requires login: false
- Requires API key: false
- Stores user data: false


## Examples

- Does it preserve CDATA and comments?
- Why does it refuse my file?




## Questions

### Does it preserve CDATA and comments?

Do not assume it preserves every CDATA section, comment, or bit of significant whitespace unchanged. It checks the XML with a parser, then formats the original text with a small indenter. For documents that rely on exact text or mixed content, keep the original and inspect the result closely.

### Why does it refuse my file?

The parser is strict. A stray ampersand, an undeclared namespace prefix or a mismatched tag will stop it, and the error names the position.

