Skip to content
Kordu Tools Kordu Tools

XML Formatter

Runs in browser

Format, minify, and validate XML online — syntax checking with clear error messages, configurable indent, real-time output.

Last updated 08 Apr 2026

Format XML with configurable indentation, minify it to a single line, or validate it for well-formedness errors. The tool uses the native browser DOMParser to parse XML and reports exact error locations. All processing runs client-side — your data never leaves the browser.

Indent:
Loading rating…

How to use

  1. 1

    Paste your XML

    Type or paste your XML content into the input panel on the left. The tool accepts any well-formed XML including documents, fragments, SOAP envelopes, RSS feeds, SVG, and config files.

  2. 2

    Choose a mode

    Select Format to pretty-print with indentation, Minify to compress to a single line, or Validate to check well-formedness without transforming the content.

  3. 3

    Adjust indentation if needed

    When in Format mode, toggle between 2-space and 4-space indentation using the indent selector. The output updates immediately.

  4. 4

    Review errors

    If your XML has syntax errors, the error panel shows the exact issue and its location. Fix the input and the output updates in real time.

  5. 5

    Copy the result

    Click Copy to copy the formatted or minified XML to your clipboard with one click.

Frequently asked questions

What does 'well-formed XML' mean?
A well-formed XML document follows all XML syntax rules: it has a single root element, all tags are properly closed, attributes are quoted, and special characters in content are properly escaped. Well-formedness is checked by any XML parser — it is a prerequisite before the XML can be processed.
Does this validate against an XML Schema or DTD?
No — this tool checks well-formedness only, not validity against an external schema (XSD) or DTD. Well-formedness validation catches syntax errors; schema validation would additionally verify that elements and attributes match a specified structure.
Does it support XML namespaces?
Yes. The tool uses the browser's native DOMParser which fully supports namespace-prefixed elements and attributes, default namespace declarations, and namespace-qualified attributes.
What happens to CDATA sections?
CDATA sections are preserved as-is in the formatted output. The formatter does not collapse or alter CDATA content.
Can I format SVG files?
Yes. SVG is XML and formats correctly. Paste your SVG source and use Format mode to get a clean indented representation.
Is my XML uploaded anywhere?
No. All formatting and validation runs entirely in your browser using the native DOMParser API. Nothing is sent to a server, and no data is stored or logged.
What is the difference between Format and Minify?
Format adds consistent indentation and line breaks to make the XML human-readable. Minify removes all insignificant whitespace between tags to produce the smallest possible file size, useful for storage or transmission where readability is not needed.

XML Formatter handles the three most common XML tasks in one place. Format

mode pretty-prints your XML with configurable indentation (2 or 4 spaces),

preserving comments, CDATA sections, processing instructions, and namespace

declarations. Minify mode strips all insignificant whitespace between tags,

producing the smallest possible single-line representation for embedded

payloads, configuration storage, or network transmission. Validate mode

checks that the XML is well-formed and reports any parsing errors with their

exact location and a human-readable message.

Parsing uses the native browser DOMParser API — the same engine browsers use

to parse XHTML — so results are standards-compliant and handle the full XML

1.0 specification including Unicode characters, namespace prefixes, default

namespaces, and mixed content. The output updates in real time as you type,

making it easy to spot syntax errors as you write.

All processing runs entirely in your browser. Nothing is uploaded, logged, or

transmitted. Useful for debugging SOAP responses, validating config files,

inspecting RSS/Atom feeds, reviewing SVG source, or formatting XML API payloads.

Related tools