Generators Category Tool

XML Formatter and Validator for Documents and APIs

Indent XML structures and check tag closing easily.

Includes
  • Well-formed XML check
  • Adjustable indentation from 1 to 8 spaces
  • Warning for unclosed tags
  • Character, line, and element count
  • One-click copy
Real-time XML

Validate and organize your XML with consistent indentation

Paste the XML, choose the number of spaces, and follow the formatting automatically. The tool checks the structure before producing the result.

Paste compact or messy XML to see the formatting applied.

Paste or type XML to format.

Choose between 1 and 8 spaces.
Formatted resultText
The formatted XML will appear here once the input is valid.
Summary

Fix the fields to format the XML.

Characters0
Lines0
Elements0
Who it is for

Turn a one-line XML into something you can read

The formatter is for people dealing with electronic invoices, feeds, configuration files, and integrations that exchange XML.

  • Read a compact XML received from an integration.
  • Find the tag that was left unclosed.
  • Standardize indentation before sharing an example.
Instructions

How to use it

  1. 1. Paste the XML into the input field.
  2. 2. Choose the indentation, from 1 to 8 spaces.
  3. 3. Check whether the tool reports a syntax error.
  4. 4. Copy the formatted XML.
How it works

Structure is checked first, then formatting is applied

The browser reads the document and checks that it is well formed. Only then is each element placed on its own line, with the chosen indentation.

Well formed

Opened tags must be closed in the correct order.

A structural error stops formatting and shows a warning.

Indentation

Each inner level receives the chosen number of spaces.

The default is 2 spaces.

Element count

The tool shows document statistics, such as the number of elements.

This helps confirm nothing was lost when copying.

Verifiable example

A compact XML

With 2-space indentation, the document below is rearranged into three lines.

Input
<root><item>ok</item></root>
Formatted
<root>
  <item>ok</item>
</root>

Tag content is not changed: only line breaks and indentation spaces are added.

Limits

Well formed is not the same as valid

The tool checks XML syntax, not the rules of a specific format.

  • There is no schema (XSD) or DTD validation: required fields of an invoice, for example, are not checked.
  • The XML is not sent to any system; it is only read and formatted on the page.
  • Very large documents may slow down the browser.
FAQ

Frequently asked questions

What is the difference between well-formed XML and schema-validated XML?

Well-formed XML follows basic syntax rules such as closed, correctly nested tags. Schema validation also checks whether elements, attributes, and values follow a specific contract.