XML to YAML converter

Useful for moving old XML settings into the YAML files used by Docker, Kubernetes and CI tools.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter xml text and turn numbers and true/false into typed values.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

XML is first mapped to a JSON structure (@ attributes, #text, arrays for repeats), then written as block YAML with 2-space indents. Any string that starts with a digit or special character, or looks like a boolean or null, is double-quoted.

Example

Inputs: Turn numbers and true/false into typed values = no. Result: YAML: catalog: book: - "@id": "1" "@lang": ar title: مقدمة ابن خلدون author: ابن خلدون price: "45" - "@id": "2" "@lang": en title: Arabian Sands author: Wilfred Thesiger price: "60"; Elements: 9.

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1" lang="ar">
    <title>مقدمة ابن خلدون</title>
    <author>ابن خلدون</author>
    <price>45</price>
  </book>
  <book id="2" lang="en">
    <title>Arabian Sands</title>
    <author>Wilfred Thesiger</author>
    <price>60</price>
  </book>
</catalog>
catalog:
  book:
    - "@id": "1"
      "@lang": ar
      title: مقدمة ابن خلدون
      author: ابن خلدون
      price: "45"
    - "@id": "2"
      "@lang": en
      title: Arabian Sands
      author: Wilfred Thesiger
      price: "60"

Limits and caveats

  • XML comments and processing instructions are not carried into the YAML.
  • The order of mixed text between elements is not kept, it is joined into #text.

Questions about this tool

Why are some values quoted?

YAML reads values such as yes, on and 08 in special ways, so quoting keeps them as the same text they were in the XML.

Is the output ready for Kubernetes or Docker Compose?

It is valid YAML, but the key names come from your XML tags, so you may need to rename them to match the schema the tool expects.

How do repeated elements look?

They become a YAML list where each item starts with a dash, like the list of books in the example.