YAML vs XML: A Simple Comparison

If you're under about 30, there's a decent chance you've never had to write raw XML by hand, and honestly, you didn't miss much. But it's worth understanding why YAML pushed XML out of so many config files, because the reasons say a lot about what makes a format pleasant to use.

The same three lines, two ways

<user>
  <name>Aditi Verma</name>
  <remote>true</remote>
</user>
user:
  name: Aditi Verma
  remote: true

Same information. The XML version needs an opening and closing tag for every single value — <name> and </name> — which adds up fast in a large file. YAML just uses indentation, so there's roughly half the characters to type and read.

What XML still does better

XML has things YAML never really tried to compete on: strict schemas (XSD) that can validate a document's exact structure before anything runs, namespaces for mixing vocabularies from different sources, and mixed content where text and tags interleave — which matters for documents, not just data. That's why XML hasn't disappeared: it's still common in enterprise systems, SOAP APIs, Microsoft Office file formats, and places where a formal, machine-verifiable contract matters more than human readability.

Why config files moved to YAML

Most configuration files are read by a person way more often than they're validated by a strict schema tool. Docker Compose, Kubernetes, Ansible and CI pipelines all chose YAML because someone is going to open that file, scan it, and probably edit a value by hand — and YAML is simply faster to read in that situation. The closing-tag repetition that makes XML robust is the same thing that makes it tedious to hand-edit.

If you're migrating an old XML config to YAML, the fastest way to get comfortable is to convert a JSON version first (since JSON and YAML map onto each other cleanly) using our converter, then check the result against YAML's syntax rules.

← Format your YAML now