What are XML and YAML?
XML marks data with opening and closing tags and attributes; it is older than JSON and still the format of SOAP services, RSS, Office files and many government and banking integrations. YAML describes the same data as JSON with indentation instead of brackets, allows comments and is the language of most configuration files.
Developers do this to read a large XML configuration or API response comfortably, or to move an old XML config to a YAML-based tool.
This page opens the data converter already set to XML → YAML. Paste the text, read the result as you type, then copy it or download it as a file. Errors show the line and the column. Nothing is sent anywhere: the conversion runs in your browser.
XML vs YAML
| XML | YAML | |
|---|---|---|
| Extension | .xml | .yaml, .yml |
| Media type | application/xml | application/yaml |
| Comments | yes (<!-- -->) | yes (#) |
| Data types | everything is text (types come from a schema) | JSON types plus dates, anchors and aliases |
| Nesting | any depth, plus attributes | any depth, by indentation |
| Typical use | SOAP, RSS, invoices, Office files | Kubernetes, Docker Compose, CI pipelines |
| Specification | W3C XML 1.0 | YAML 1.2.2 |
When to convert XML to YAML
- Convert to YAML when people will read and edit the file by hand.
- Keep XML when a SOAP service, a feed or a legacy system expects XML.
What changes in the conversion
- Comments of the XML file are not carried over: the converter reads the data, and comments are not data.
- Attributes become keys starting with
@(@id), the text of an element that also has attributes becomes#text, repeated elements become a list, and numbers and booleans are recognized.
How to convert XML to YAML
- Paste your XML in the input box (the page opens with an example you can replace).
- Read the YAML on the right; it updates as you type. If something is wrong, the message says the line and column.
- Adjust the options if you need: indentation, sorted keys or type detection.
- Copy the result or download it as a
.yamlfile.
Example
This XML input:
<?xml version="1.0"?>
<config>
<app name="orders" port="8080"/>
<database pool="10">postgres://db:5432/orders</database>
</config>becomes this YAML, exactly as the converter writes it:
config:
app:
"@name": orders
"@port": 8080
database:
"@pool": 10
"#text": postgres://db:5432/orders
Frequently asked questions
Is my XML sent to a server?
No. Conversion happens in your browser, so secrets in a config never leave your computer.
Does XML to YAML keep comments?
No. Comments are dropped because the converter works on the data itself. Copy important comments by hand.
What happens to nested data?
XML nesting: any depth, plus attributes. YAML nesting: any depth, by indentation. The structure is kept as it is.