Ttooleras
📋

Beautify and validate XML documents — SOAP, RSS, SVG, configs. Free, private — all processing in your browser.

Advertisement

The XML Formatter beautifies messy or minified XML documents into properly indented, readable output. Works with any XML variant: SOAP envelopes, RSS and Atom feeds, SVG graphics, XHTML, XML config files (Spring, Maven pom.xml, Android manifests), WSDL service descriptions, XSLT stylesheets, and any custom XML schema. Unlike HTML, XML is strict — all elements must close, attributes must be quoted, and there is one root element. This formatter validates strict XML rules while formatting, catching errors that would break parsers.

XML remains essential in enterprise contexts (banking, healthcare, government APIs), legacy systems, SOAP web services, configuration (Maven, MSBuild, Android), data interchange (RSS, Atom), and vector graphics (SVG). Despite JSON displacing XML for new web APIs, XML is far from dead. Being able to quickly beautify and validate XML is a daily need for developers working with enterprise systems, legacy APIs, or SVG editing. This formatter handles everything XML throws at it — namespaces, CDATA sections, processing instructions, DTD declarations, and comments.

XML Formatter — key features

Beautify any XML

SOAP, RSS, SVG, config files, custom XML — all handled with proper indentation.

Well-formedness validation

Checks: single root, closed tags, quoted attributes, escaped special chars. Errors reported with line numbers.

Preserves CDATA

CDATA section contents (often code) preserved verbatim — not reformatted.

Namespace handling

XML namespaces and prefixes correctly preserved through formatting.

Attribute wrapping

Long attribute lists wrap onto multiple lines for readability.

Indentation options

2 spaces (default), 4 spaces, or tab.

Comments preserved

XML comments kept in their original positions.

100% client-side

Your XML (possibly with sensitive business data, SOAP credentials) stays in browser.

How to use the XML Formatter

  1. 1

    Paste XML

    SOAP response, RSS feed, SVG file, config XML, or any well-formed XML document.

  2. 2

    Set indentation

    2 spaces (default), 4 spaces, or tab. Match your project convention.

  3. 3

    Click Format

    Cleanly indented XML appears. Errors are highlighted with line numbers.

  4. 4

    Review and copy

    Copy formatted XML to clipboard or download as .xml file.

Common use cases for the XML Formatter

Web services

  • SOAP envelope debugging: SOAP requests/responses come as minified XML. Format to read structure.
  • Enterprise API integration: Banking, healthcare, government APIs often XML. Format for debugging.
  • WSDL service definitions: Understand what a SOAP service exposes — format the WSDL.
  • SAML assertions: SSO uses SAML — XML format. Debug auth issues by formatting.

Configuration

  • Maven pom.xml: Java build config. Format to understand or audit dependencies.
  • Spring XML configs: Old-style Spring DI. Format for reading or converting to annotation config.
  • Android manifests: AndroidManifest.xml defines app permissions, activities. Format before review.
  • MSBuild files: .NET project files — XML. Format for clarity.

Content and feeds

  • RSS/Atom feeds: Blog feeds as XML. Format for debugging or inspection.
  • OPML feed lists: Feed readers export OPML — XML format.
  • Podcast feeds: iTunes podcast XML with iTunes-namespace extensions.
  • Sitemap XML: XML sitemaps for SEO. Format to review URLs.

Graphics

  • SVG cleanup: Hand-edit SVG files formatted for readability.
  • Compare SVG versions: Format both versions before diffing to avoid whitespace noise.
  • Inline SVG in HTML: Extract and format for editing.

XML Formatter — examples

Basic XML formatting

Single-line XML to indented.

Input
<?xml version="1.0"?><root><user><name>Alice</name><age>30</age></user></root>
Output
<?xml version="1.0"?>
<root>
  <user>
    <name>Alice</name>
    <age>30</age>
  </user>
</root>

SOAP envelope

Web service message.

Input
<?xml version="1.0"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><m:GetUser xmlns:m="http://example.com/users"><m:Id>42</m:Id></m:GetUser></soap:Body></soap:Envelope>
Output
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <m:GetUser xmlns:m="http://example.com/users">
      <m:Id>42</m:Id>
    </m:GetUser>
  </soap:Body>
</soap:Envelope>

SVG

Vector graphic XML.

Input
<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="red"/><text x="50" y="55" text-anchor="middle">Hi</text></svg>
Output
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <circle cx="50" cy="50" r="40" fill="red"/>
  <text x="50" y="55" text-anchor="middle">Hi</text>
</svg>

RSS feed

Blog RSS.

Input
<?xml version="1.0"?><rss version="2.0"><channel><title>Blog</title><item><title>Post</title><link>https://example.com/post</link></item></channel></rss>
Output
<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Blog</title>
    <item>
      <title>Post</title>
      <link>https://example.com/post</link>
    </item>
  </channel>
</rss>

CDATA preserved

Code inside XML unchanged.

Input
<script><![CDATA[if(x<5&&y>3){doIt();}]]></script>
Output
<script>
  <![CDATA[if(x<5&&y>3){doIt();}]]>
</script>

(CDATA content preserved exactly)

Error detection

Invalid XML reported.

Input
<root><open></root>
Output
✗ Error at line 1, column 14:
Mismatched closing tag: expected </open>, found </root>

Technical details

XML (eXtensible Markup Language, W3C standard since 1998) is a strict markup language designed for data representation.

XML rules (stricter than HTML):

- All elements must close: <p>text</p> or self-closing <br/>. Unlike HTML, no optional closing tags.
- Attributes must be quoted: <a href="url"> — no unquoted attributes.
- One root element: document must have exactly one top-level element.
- Case-sensitive: <Foo> and <foo> are different elements.
- Special characters escaped: &lt;, &gt;, &amp;, &quot;, &apos; or numeric (&#60;).
- XML declaration optional but conventional: <?xml version="1.0" encoding="UTF-8"?> at document start.

Formatting rules:

- One element per line.
- Nested elements indented (2 or 4 spaces).
- Long attribute lists can be wrapped onto multiple lines.
- Comments (<!-- -->) preserved.
- CDATA sections (<![CDATA[...]]>) preserved verbatim (content not reformatted).
- Processing instructions (<?xml-stylesheet ... ?>) preserved.

Common XML documents:

SOAP envelope:
``xml
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
<m:GetPrice xmlns:m="http://example.com/stocks">
<m:StockName>IBM</m:StockName>
</m:GetPrice>
</soap:Body>
</soap:Envelope>
``

RSS feed:
``xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Tooleras Blog</title>
<link>https://tooleras.com/blog</link>
<description>Developer tools and tutorials</description>
<item>
<title>Blog Post Title</title>
<link>https://tooleras.com/blog/post</link>
</item>
</channel>
</rss>
``

SVG:
``xml
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="red"/>
</svg>
``

Android manifest:
``xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<application android:icon="@drawable/icon">
<activity android:name=".MainActivity"/>
</application>
</manifest>
``

Namespaces:

XML uses namespaces to disambiguate elements from different vocabularies:

``xml
<root xmlns:book="http://example.com/book" xmlns:music="http://example.com/music">
<book:title>XML Guide</book:title>
<music:title>Song Name</music:title>
</root>
``

Formatter preserves namespace prefixes and declarations.

CDATA sections:

Text inside CDATA is not parsed as XML — used for code snippets, special characters:

``xml
<script><![CDATA[
if (x < 5 && y > 3) {
doSomething();
}
]]></script>
``

Formatter preserves CDATA contents verbatim (does not reformat internal text).

Validation levels:

- Well-formed: follows XML syntax rules (one root, closed tags, quoted attributes, escaped chars).
- Valid: conforms to a schema (DTD, XSD, RelaxNG). Requires schema validation.

This formatter checks well-formedness. For validity, use schema validator.

Encoding:

XML declares its encoding (encoding="UTF-8" typical). UTF-8 is the web standard. Legacy systems may use Windows-1252, ISO-8859-1. Check declared encoding matches actual bytes.

Common problems and solutions

Case sensitivity differs from HTML

XML is case-sensitive. <Foo> and <foo> are different elements. HTML tolerates case mixing; XML rejects. Match case exactly.

Missing XML declaration

Technically optional but strongly recommended. Include <?xml version="1.0" encoding="UTF-8"?> at the very top for clarity about version and encoding.

Encoding mismatches

XML declaration says one encoding but bytes are different. Save file with UTF-8 encoding to match. Non-UTF-8 causes parse errors for non-ASCII characters.

Namespace prefix issues

Prefixes (soap:, xsi:) must be declared (xmlns:soap=). Using undeclared prefix breaks parsers. Copy full declarations with prefixes.

Self-closing vs explicit close

<br/> and <br></br> are equivalent in XML. Convention varies. XML formatters may convert — check if your consumer expects specific form.

Attribute order

XML attribute order is not semantically meaningful but some strict parsers care. Formatter may reorder — disable attribute sorting if your consumer is picky.

Whitespace handling

XML whitespace is mostly significant. Formatter adds readable whitespace but may affect consumers that care. Test after formatting.

CDATA section syntax

<![CDATA[...]]> — note the exact syntax. Typos make it not CDATA. Contents not HTML-escaped (used for code, special chars).

XML Formatter — comparisons and alternatives

XML vs HTML formatting: XML is strict (all tags must close, attributes quoted, case-sensitive). HTML is permissive. XML formatters reject invalid XML; HTML formatters tolerate errors. See HTML Formatter.

XML vs JSON: XML is verbose with start/end tags; JSON is compact with braces. XML supports namespaces, CDATA, DTD schemas. JSON simpler. Most new APIs use JSON.

XML Formatter vs XML Minifier: Formatter expands. Minifier compresses (remove whitespace, collapse attributes). Both lossless roundtrip.

This tool vs xmllint (CLI): xmllint is the classic Unix XML tool. Handles huge files, schema validation. This tool for browser-based ad-hoc formatting.

XML vs SVG: SVG is XML-based. Same formatting rules. SVG has specific tags (path, circle, rect) but formatting is identical to generic XML.

Well-formed vs Valid: Well-formed = follows XML syntax rules. Valid = conforms to a specific schema. This formatter checks well-formedness. For schema validation (DTD/XSD), use dedicated validators.

Frequently asked questions about the XML Formatter

What is XML?

Extensible Markup Language — a text format for structured data, standardized by W3C since 1998. Used for SOAP APIs, RSS feeds, SVG graphics, configuration files (Maven, Android), and data interchange. Stricter than HTML — all tags must close, attributes quoted, case-sensitive.

Why format XML?

Formatted XML is easier to read, debug, and compare. Minified XML is compact but nearly unreadable. Formatting makes hierarchical structure visible through indentation.

Does this validate XML?

Checks well-formedness (syntax rules). Reports errors like unclosed tags, mismatched tags, unquoted attributes. For schema validation (DTD/XSD compliance), use dedicated validator tools.

Is my XML safe?

Yes. Formatting happens in your browser. XML data never uploads. Safe for SOAP messages with credentials, internal configs, sensitive APIs.

Can it format SOAP messages?

Yes. SOAP is XML. This formatter handles SOAP envelopes, headers, bodies, namespace prefixes (soap:, m:, etc.). Common for debugging enterprise integration.

What about CDATA sections?

Contents preserved verbatim. CDATA typically contains code or text with special characters. Formatter does not reformat CDATA content — preserves exact whitespace and text.

Does it work with SVG?

Yes. SVG is XML-based. Formatter handles SVG elements (path, circle, rect, text) and attributes properly. Useful for cleaning up hand-edited SVG files.

What is a well-formed XML error?

Common causes: (1) Unclosed tag — every open tag needs matching close. (2) Unquoted attribute — attributes must be in quotes. (3) Multiple root elements — XML must have exactly one. (4) Case mismatch — <Foo> and <foo> are different. (5) Unescaped characters — <, >, &, must be &lt;, &gt;, &amp;.

Can it handle namespaces?

Yes. Namespace prefixes (xmlns:prefix=) and prefixed elements/attributes preserved through formatting. Formatter does not invent namespaces — preserves what is in the source.

What if my XML is very large?

Multi-megabyte XML formats fine in most browsers. For very large files (100+ MB), use command-line tools (xmllint, xmlstarlet) that can stream process without loading entire document.

Additional resources

Advertisement

Learn more

Explore more tools

200+ free tools that run in your browser.

Browse all tools →