Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

XML Formatter & Validator — Beautify XML Online

Turn minified or messy XML into clean, indented markup and check that it is well-formed — for feeds, sitemaps, SOAP messages, configs and SVG.

Mis à jour le
Open file
Indent

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : XML Formatter

  1. Paste XML or open a file such as .xml, .rss, .svg or .plist.
  2. Choose 2 spaces, 4 spaces or tabs for indentation.
  3. If the XML is not well-formed, the error and line number are shown.
  4. Copy or download the formatted result.

What is an XML formatter?

An XML formatter (or pretty-printer) re-indents a document so every element starts on its own line and nesting is visible at a glance. It is the fastest way to read an API response, a minified feed, a generated sitemap or a configuration file that arrived as one long line.

<catalog><product id="KB-001"><name>Keyboard</name></product></catalog>

becomes

<catalog>
  <product id="KB-001">
    <name>Keyboard</name>
  </product>
</catalog>

Well-formedness check

Before formatting, the document is parsed with the browser’s XML parser. Well-formed XML must follow a few strict rules — breaking any of them produces an error with the line number:

  • Exactly one root element.
  • Every start tag has a matching end tag, or is self-closing (<br/>), and tags nest properly.
  • Attribute values are quoted, and no attribute appears twice on one element.
  • & and < in text are escaped as &amp; and &lt; (or placed in CDATA).
  • Element names are case-sensitive: <Item> is not closed by </item>.

Validation against a schema (XSD, DTD) is a separate step that checks which elements are allowed; well-formedness is the prerequisite for it.

Formatting rules

Elements that contain only text stay on one line (<price>89.99</price>), empty elements are kept compact, and CDATA sections and processing instructions are preserved unchanged. Need the opposite? The XML minifier removes the indentation again. Working with JSON instead? Use the JSON formatter.

Aussi recherché comme : beautify xml, xml pretty print, xml validator, format xml online, xml viewer, indent xml.

Outils complémentaires : XML Formatter

  • HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
  • Sitemap Validator — Find and validate your XML sitemap — URL count, sitemap index children, lastmod coverage, duplicates and foreign-host URLs — and check that the pages it lists really return 200.
  • SVG Optimizer — Clean up SVGs exported from Figma, Illustrator, Inkscape or Sketch with SVGO — and check the before/after preview to make sure the icon still looks right.
  • CSS Formatter — Turn a minified stylesheet into readable CSS with one property per line and properly nested @media blocks.

Questions fréquentes

How do I validate XML online?
Paste it above. If the document is not well-formed, the parser error and its line number are shown; otherwise the formatted XML appears.
Does formatting change my data?
Only whitespace between tags changes. Text inside elements, attribute values and CDATA sections are kept as they are.
Can it format SVG and RSS?
Yes. SVG, RSS, Atom, sitemaps, SOAP, plist and other XML-based formats all work.
Is my XML sent to a server?
No. Parsing and formatting run in your browser.
Puis-je installer XML Formatter en tant qu’application web et l’utiliser hors ligne ?
Oui. XML Formatter est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires