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
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat 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
Paste XML into the input panel.
Set the indentation.
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.
<config><host>localhost</host><port>8080</port><debug>true</debug></config>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.
Related Tools
YAML to XML Converter
Convert YAML to XML online. Supports nested objects, arrays, and custom root element names with optional XML declaration.
XML to JSON Converter
Parse and convert XML to clean JSON instantly — attributes, namespaces, and nested elements handled.
XML to CSV Converter
Convert XML to CSV online. Flattens repeated XML elements into rows and columns with configurable quoting and header options.
YAML to JSON Converter
Convert YAML to JSON and JSON to YAML — for config files, CI pipelines, and Kubernetes manifests.
YAML Beautifier
Format and prettify YAML with configurable indentation and optional key sorting. Validates YAML syntax instantly.
XML Validator
Validate XML syntax online. Shows valid/invalid status with exact error line and column, plus structure stats including root element name and element count.

