WebToolsPlanet
Converter Tools

XML to YAML Converter

Paste XML and get YAML — element names become mapping keys, attributes get an @ prefix, and repeating siblings are automatically serialized as sequences.

Last updated: May 27, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is XML to YAML Converter?

YAML is often preferred over XML for configuration and data files because it is more readable. Converting XML to YAML manually requires mapping each element to a key, lifting attributes, and wrapping repeated siblings in a sequence — all of which is mechanical but error-prone.

This tool uses the browser DOMParser to parse the XML, then walks the DOM to produce a JSON-compatible value, and finally converts that to YAML. Attributes are preserved with an @ prefix. Repeated sibling elements with the same tag name become YAML sequences. Text nodes coexist with attributes under the #text key.

How to Use XML to YAML Converter

1

Paste XML into the input panel.

2

Set the indentation.

3

Copy the YAML output.

Common Use Cases

  • Converting an XML configuration file to YAML for a tool that prefers YAML.
  • Migrating Maven pom.xml data to Gradle or Helm values YAML.
  • Transforming an XML API response to YAML for inspection or documentation.
  • Learning the structural difference between XML and YAML representations.

Example Input and Output

An XML document converts to an equivalent YAML structure.

XML input
<config><host>localhost</host><port>8080</port><debug>true</debug></config>
YAML output
config:
  host: localhost
  port: '8080'
  debug: 'true'

Privacy

All XML parsing and YAML generation happen in your browser. No content is sent to a server.

String values

All XML values are strings. Numbers and booleans will appear quoted in YAML. Convert the YAML further with the YAML to JSON tool to coerce types.

Frequently Asked Questions

How are XML attributes handled?
Attributes are mapped to keys with an @ prefix — for example, <book id="1"> becomes { "@id": "1", ... }.
How are repeated elements handled?
Sibling elements with the same tag name are combined into a YAML sequence. For example, multiple <item> elements under <items> become an array.
Are values typed (numbers, booleans)?
XML text content is always a string, so values remain quoted strings in YAML. Use the YAML to JSON tool if you need type coercion.
Does this send my XML anywhere?
No. All parsing and conversion happen locally in your browser.