XML FORMATTER / VALIDATE · MINIFY

XML Formatter

Format, validate and minify XML; errors point to the line.

Runs locally · code is not uploaded
Options

YOUR NEXT STEP

Connect useful tools with your company workflow

Create a company account to configure website monitoring, business email and notifications, and invite your team to work together.

New companies receive a 14-day Pro trial, with no card required. Trials exclude the paid monthly credit grant.

Already have an account? Open your workspace →

How to use it

  1. Paste code, drop a file or load the sample; the language is preset for this page and can be changed.
  2. Choose format or minify and adjust indent, width and other options; the result appears on the right as you type.
  3. Copy or download the result; on an error, use "Go to error", fix it and run again.

Five rules of well-formed XML

The XML is checked before formatting; errors show the line and column, and "Go to error" jumps there.

Common mistakes
RuleWrongRight
Exactly one root element<a/><b/><root><a/><b/></root>
Tags close and nest properly<a><b></a></b><a><b></b></a>
Attribute values are quoted<a x=1><a x="1">
Escape special charactersTom & JerryTom &amp; Jerry
Case sensitive<Item></item><Item></Item>

Languages and engines

Formatting uses the same open-source engines as popular editors, so results match Prettier in VS Code and your team can keep one style. Every engine loads from this site and runs in your browser.

Language
LanguageFormatCompress
HTMLPrettier 3✓ comments and whitespace
XMLXunL XML engine✓
CSS / SCSS / LessPrettier 3✓ CSSO restructuring
JavaScript / TypeScriptPrettier 3(Babel)✓ Terser (JavaScript only)
JSONPrettier 3✓ big numbers keep precision
YAMLPrettier 3— (comments kept)
SQLsql-formatter (14 dialects)—

Frequently asked questions

Does it validate against an XSD?

It checks that XML is well-formed: tags match and nest, attributes are quoted and there is one root. Validity against an XSD or DTD needs a dedicated validator.

Does formatting change the data?

Elements, attributes and text stay the same; only indentation and line breaks change. Whitespace-only text nodes are dropped and unquoted values get double quotes. Check whitespace-sensitive documents such as xml:space="preserve" first.

Is my code uploaded?

No. The engines download from this site and run in your browser; your code never passes through our servers or any third party, so it is safe for internal code and configuration.

How large can files be?

Up to 5 MB per file; above 300 KB the page waits for the button instead of formatting as you type, to keep the browser responsive.

XML formatter practical guide and common questions

What does an XML formatter do?

The XML is first checked against XML 1.0 well-formedness (matching and nested tags, one root, quoted attributes, closed comments and CDATA), then indented by depth; text-only elements stay on one line and CDATA, comments and DOCTYPE are kept as written.

Who is this for, and when is it useful?

Developers, SEO and data staff handling sitemaps, RSS, SOAP, product feeds and XML configuration, debugging errors or reading one-line XML.

How do I use this XML formatter?

Paste XML for clean indentation while tags, root element and attribute quotes are checked, with line and column on errors; or minify it to one line.

How should I interpret the results?

It checks well-formedness only, not XSD or DTD validity; mixed content (text interleaved with child elements) is split across lines, so confirm whitespace-sensitive documents first.

Where is the work performed, and which services receive data?

XML is checked and formatted locally and never uploaded, so internal messages and product data stay private.