Spreadsheet & CSV Tools

XML to YAML

Turn XML into clean, readable YAML. Elements become keys, elements that repeat become lists, attributes become keys starting with @, text with line breaks becomes a block scalar, and numbers and booleans can be typed. Values that some YAML parsers would misread, such as the country code NO, are quoted automatically.

  • Runs in your browser
  • No sign-up
  • Free to use

How to use XML to YAML

  1. Paste XML or open a file.
  2. Choose whether to include attributes and type values.
  3. Pick the indentation.
  4. Copy or download the YAML.

XML to YAML features

Natural mapping

Elements to keys, repeats to lists, text to values.

Attributes

Kept as @name keys or left out.

Typing

Numbers and booleans as YAML types; ids with leading zeros stay text.

Safe output

Quotes values like NO, yes and on that YAML 1.1 tools treat as booleans.

Multi-line text

CDATA and long text become readable block scalars.

Local

Converted in your browser.

When to use XML to YAML

  • Moving application settings from XML files to YAML.
  • Reading a verbose XML response in a compact form.
  • Preparing data for tools configured in YAML, such as CI pipelines.
  • Comparing XML documents more easily as YAML.

XML to YAML FAQ

How are repeated elements handled?

Two or more child elements with the same name become a YAML list under that name.

What happens to attributes?

They become keys prefixed with @, next to the child elements. Text content alongside attributes is stored under #text.

Why is NO quoted?

YAML 1.1 parsers, including some versions of PyYAML and many CI tools, read NO, yes, on and off as booleans. Quoting keeps them as text everywhere.

Are comments and namespaces kept?

Comments are dropped. Namespace prefixes remain part of element names.

Can I convert YAML back to XML?

Yes, with the YAML to XML tool.

Is my data uploaded?

No. Everything happens in your browser.

From XML trees to YAML

XML and YAML both describe nested data, but they look very different. XML repeats every element name in opening and closing tags and distinguishes attributes from child elements; YAML uses indentation and colons and has only mappings, lists and scalar values. Converting XML to YAML usually makes data much shorter and easier to read.

The mapping follows common conventions. Each element becomes a key holding its content: plain text for simple elements, a nested mapping for elements with children. When the same element name repeats under one parent, the values are collected into a list. Attributes become keys with an @ prefix, and when an element has both attributes and text, the text is stored under #text.

XML text is always a string, while YAML has numbers and booleans. With typing on, text that is clearly a number or true/false becomes the YAML type, but values that would change, such as ids with leading zeros, stay text. Multi-line text, for example from CDATA sections, is written as a YAML block scalar so line breaks are preserved.

YAML has a well-known trap: older YAML 1.1 parsers treat words such as no, yes, on and off as booleans, so a country code NO can silently become false. The output quotes such values so that every YAML parser reads them as text.

The XML is parsed with the browser’s standards-compliant parser, which reports the line and column of errors, and the YAML is written with js-yaml, a widely used implementation. Comments and processing instructions are not carried over.

Other useful tools