# XML Formatter & Beautifier — Indent, Minify and Check

> Format messy XML with proper indentation, or minify it back down, with well-formedness checked.

To format XML, paste it in and it is re-indented with each element on its own line — except elements holding only text, which stay on one line because splitting them across three is what makes formatted XML unreadable. The document is parsed by your browser's own XML parser first, so anything not well-formed is reported with its line and column rather than silently mangled.

**URL:** https://convertto.tech/t/xml-formatter
**Category:** Data & Format Tools (https://convertto.tech/c/data-tools)
**Privacy:** Runs entirely in the browser; no upload
**Cost:** Free, no sign-up
**Last updated:** 2026-08-01

## Key facts

- **Privacy:** Runs entirely in your browser — nothing is uploaded
- **Cost:** Free, unlimited, no sign-up

## How to use

1. Enter or paste your xml.
2. Choose the mode.
3. Choose the indentation.
4. Turn "Collapse empty elements to self-closing tags" on or off as needed.
5. The result appears immediately — copy or download it.

## FAQ

### Why does formatting change my document?

It should not change anything meaningful, but XML whitespace is technically significant — a parser is entitled to treat the spaces inside an element as content. For mixed-content documents such as XHTML, re-indenting genuinely alters the text. For data XML, which is nearly all XML, it is safe.

### What is the difference between well-formed and valid XML?

Well-formed means the syntax is correct: tags nested and closed, one root element, attributes quoted. Valid means it also matches a schema or DTD that says which elements may appear where. This checks well-formedness; a schema check needs the schema.

### Why does my XML fail on an ampersand?

A bare `&` starts an entity reference, so `Smith & Jones` is a syntax error. Write `&amp;`, or wrap the value in a CDATA section. The same applies to `<` inside text, which must be `&lt;`.

## Related tools

- [XML Validator](https://convertto.tech/t/xml-validator): Check XML is well-formed, with the exact line and column of the first error and a document summary.
- [Data Format Converter](https://convertto.tech/t/data-format-converter): Convert between JSON, YAML, XML, CSV, TSV and TOML in any direction, locally in your browser.
- [Excel to XML Converter](https://convertto.tech/t/excel-to-xml): Export spreadsheet rows as XML with safe element names.
- [PDF to XML Converter](https://convertto.tech/t/pdf-to-xml): Export PDF page layout into structured XML with per-line coordinates.
- [XML Sitemap Generator](https://convertto.tech/t/sitemap-generator): Turn a list of URLs into a valid XML sitemap ready to submit to search engines.
- [HTML to XML Converter](https://convertto.tech/t/html-to-xml): Convert HTML into well-formed XHTML that an XML parser will accept.
- [Word to XML Converter](https://convertto.tech/t/word-to-xml): Convert a Word document into clean structural XML.
- [Mock Data Generator](https://convertto.tech/t/mock-data-generator): Generate realistic fake test data in 14 formats from 100+ field types, with reproducible seeds.
