XML to YAML

Convert an XML document into YAML — elements become keys, repeated elements become lists and attributes are kept — so config or feed data is easier to read and edit. Runs in your browser.

Suggested tools

YAML to XML

Convert YAML into XML.

YAMLXML
Open Tool

JSON to YAML

Convert JSON into readable YAML.

JSONYAML
Open Tool

YAML to JSON

Convert YAML into JSON.

YAMLJSON
Open Tool

YAML Formatter

Re-indent YAML and check it for syntax errors, with line numbers.

YAML
Open Tool

YAML to CSV

Convert a YAML list into CSV.

YAMLCSV
Open Tool

CSV to YAML

Convert CSV into YAML.

CSVYAML
Open Tool

About XML to YAML

XML to YAML converts an XML document into YAML, which is shorter and far easier to read and edit by hand. Child elements become keys, repeated elements become lists, and attributes are kept as keys prefixed with @_ so no information is lost.

Values such as 007, +919876543210 or 12E4 are kept as written rather than turned into numbers, so codes and phone numbers stay intact. Everything runs locally in your browser — the text you paste is never uploaded.

How to use XML to YAML

  1. Paste XML or upload an .xml file.
  2. Press Convert.
  3. Copy or download the YAML.

Key features

  • Attributes preserved with an @_ prefix
  • Repeated elements become YAML lists
  • Leading zeros and codes kept as text
  • Checks the XML is well-formed first

Example

Attributes are kept with an @_ prefix.

Input
<config><db host="localhost" port="5432"/><cache>redis</cache></config>
Output
config:
  db:
    '@_host': localhost
    '@_port': '5432'
  cache: redis

When to use XML to YAML

  • Turning XML configuration into YAML for modern tools.
  • Making a large XML export easier to read and review.
  • Converting XML data into YAML fixtures for tests.

Tips and common problems

  • Keys starting with @_ were XML attributes.
  • Repeated elements become lists; a single element becomes a mapping.
  • Codes and numbers with leading zeros stay as text.

Frequently asked questions

They were XML attributes. The prefix keeps them apart from child elements with the same name, so the data can be converted back.