# XML Formatter & Validator

> Free XML formatter and validator. Pretty-print XML, minify to one line, and check well-formedness with clear errors. All client-side.

Pretty-print XML with clean indentation, minify it to one line, and validate well-formedness with clear error messages pointing at the problem.

*Interactive tool: enter your values at https://toollantern.win/xml-formatter-validator/ and results update instantly in your browser.*

## What the tool does

Paste XML and choose: pretty-print it with two-space indentation so the structure is visible, or minify it to a single line for transport. Either way the document is parsed first, so malformed XML is reported with the parser's error message instead of silently mangled.

## Worked example

<root><item>1</item></root> pretty-prints to:

<root>
  <item>1</item>
</root>

## Common errors

Unclosed tags, mismatched open/close names, unescaped & in text, and multiple root elements are the usual suspects. The validator names the first problem it finds.

## Frequently asked questions
### What does valid XML mean here?

Well-formed XML: one root element, correctly nested and closed tags, quoted attributes, and escaped special characters. This is not schema validation against a DTD or XSD.

### Does it validate against an XSD?

No. Browsers do not ship an XSD validator, so this tool checks well-formedness only, which catches the vast majority of real-world XML mistakes.

### Can it handle large files?

Yes, within reason. Multi-megabyte documents format fine in the browser; extremely large files may be slow because the whole document is held in memory.

### Is my XML sent to a server?

No. Parsing and formatting happen locally in your browser.

---
Interactive version: https://toollantern.win/xml-formatter-validator/
