XML Formatter

Format, beautify and validate XML/HTML instantly in your browser. Free online XML formatter with indentation control — no data uploaded.

Loading calculator…

Results

Formatted XML
DetailValue
Output size (chars)

What is this calculator for?

Re-indent and line-break XML so it is easy to read, and validate that it is well-formed.

How to Use This Calculator

Enter the values below, then press Calculate (or press Enter). The calculator updates your results instantly. Try different values to see how your inputs change the outcome.

  1. XML to format — enter a value. A typical XML to format would be <note><to>User</to><body>Hello</body></note>.
  2. Indentation — enter a choice from the options.
  3. Review your results — the key output is highlighted, with supporting figures below.

What You'll Need

XML to format
a value · required
Indentation
a choice from the options (2 spaces, 4 spaces, 1 tab) · optional

About This Calculator

This XML formatter parses your XML, checks that it is well-formed, and re-prints it with readable indentation.

Well-formed XML requires a single root element, properly closed tags, and correct attribute quoting. If your input has an error, the tool reports it so you can fix it. Choose 2-space, 4-space, or tab indentation to match your team’s style.

All parsing happens in your browser — nothing is uploaded.

Worked Examples

Example

<note> <to>User</to> <body>Hello</body> </note>

Frequently Asked Questions

What does "well-formed" mean?
It means the XML follows the syntax rules: one root element, every tag closed, attributes quoted, and no stray text at the document root.
Can it format HTML too?
Strictly it expects XML rules. For looser, HTML-style documents use the HTML formatter instead.