XML Formatter

Format, minify or check pasted or uploaded XML without fetching external entities.

On-device No sign-up Free to use

Format XML controls

Showing an example. Edit to see your own.

Drop your file here

or choose one from your device

Optional UTF-8 text up to 1,000,000 bytes. A chosen file replaces pasted text.

    ?

    Well-formed XML only. HTML with unclosed tags is rejected.

    Action
    Indentation
    ?

    Used by Format only.

    Processed in your browser. Your inputs stay on this device.

    Result

    Showing an example.

    Format two catalog items with nested names and prices using two-space indentation.

    <catalog updated="2026-09-28">
      <item sku="A-1">
        <name>Rope, 10 m</name>
        <price currency="USD">12.50</price>
      </item>
      <item sku="B-7">
        <name>Lantern</name>
        <price currency="USD">24.00</price>
      </item>
    </catalog>

    Loading the tool. Your result will appear here.

    https://usefreetools.net/xml-formatter · 20 November 2026

    Was this helpful?

    How to use XML Formatter

    1. Paste one XML document or choose a UTF-8 XML file. A selected file replaces the pasted text.
    2. Choose Format, Minify or Validate only. Set indentation for Format.
    3. Review the updated result or parsing error, then copy or download the output. Mixed text content may remain together to preserve meaningful whitespace.

    Example: XML Formatter

    Format two catalog items with nested names and prices using two-space indentation.

    You add
    XML: <catalog updated="2026-09-28"> <item sku="A-1"><name>Rope, 10 m</name><price currency="USD">12.50</price></item> <item sku="B-7"><name>Lantern</name><price currency="USD">24.00</price></item> </catalog>; Action: format; Indentation: two
    You get
    <catalog updated="2026-09-28"> <item sku="A-1"> <name>Rope, 10 m</name> <price currency="USD">12.50</price> </item> <item sku="B-7"> <name>Lantern</name> <price currency="USD">24.00</price> </item> </catalog>

    Options

    Choose XML file
    XML Formatter: Optional UTF-8 text up to 1,000,000 bytes. A chosen file replaces pasted text.
    XML
    Well-formed XML only. HTML with unclosed tags is rejected.
    Action
    Format adds supported indentation. Minify removes eligible layout whitespace. Validate only checks well-formedness without applying a display format; none of the actions validates an XSD schema.
    Indentation
    Used by Format only.

    Supported inputs and limits

    • Checks well-formedness with the browser XML parser; it does not validate against a DTD or XSD schema.
    • DTD declarations and custom entities are refused.
    • Formatting preserves text-bearing mixed content rather than changing its whitespace.
    • Input is capped at 2 million characters and 200,000 nodes.
    • A selected UTF-8 file replaces pasted XML and is capped at 1,000,000 bytes.
    More details

    A collapsing XML tree or built-in XML-to-JSON conversion is not provided.

    Where your input is processed

    This tool does not upload your inputs. See the limits for anything saved on your device.

    Questions about XML Formatter

    Can this validate an XML schema?

    No. It checks whether the XML is well-formed, but does not load or validate an XSD.

    Why did a paragraph remain on one line?

    Spaces around mixed text and child tags can be meaningful, so the formatter leaves that content together.

    Can I paste HTML here?

    Only if it is also well-formed XML. Ordinary HTML may have unclosed tags or other syntax this parser rejects.

    Can I use external entities?

    No. This page refuses DTD declarations and custom entity definitions.

    Page updated · Project managed by Tony Hines · Report a problem with XML Formatter