Convert YAML to XML
Turn a YAML file into indented, well-formed XML. Keys that start with @ become attributes, and lists become repeated elements. It runs in your browser, so configs stay private.
- Free, every time
- No cloud processing
- Attributes with @ keys
- Valid element names
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
YAML to XML in three steps
No account, no email, no waiting for an upload.
- STEP 01
Add your YAML
Use a .yaml, .yml or .txt file, or paste into the box.
- STEP 02
Set the XML options
Choose the attribute prefix, the root element, the name for list items and the indent.
- STEP 03
Copy or download the XML
The file starts with an XML declaration and is indented.
What YAML to XML does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Root you controlIf your YAML has one top-level key it becomes the root. Otherwise the data is wrapped in a root element with the name you choose.
- Attributes from @ keysA key such as @id is written as an attribute. Pick another prefix if @ clashes with your data.
- Lists as repeated elementsEach list item becomes an element. Lists inside lists use the item name you set.
- Safe namesKeys with spaces or characters that XML does not allow are changed, and the note says how many.
- Several documentsA file with --- separators becomes a list of documents in the XML.
Good to know
- Anchors are expandedAliases are written out in full, since XML has no equivalent.
- Comments are droppedXML output holds data only. Add comments by hand afterwards.
- Null valuesA null becomes an empty element, which looks the same as an empty string.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use YAML to XML
Feed an XML-only service
Write test data in YAML, then convert.
Migrate configuration
Move settings from YAML to an XML-based tool.
Draft XML more comfortably
YAML is quicker to type; convert when ready.
Prepare partner feeds
Maintain data in YAML and export XML.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
How YAML maps to XML
A YAML map becomes an element with a child for every key. A scalar becomes text inside its element. A list becomes the same element repeated, once per item. So a key called book holding three items gives three book elements.
Attributes are the one thing YAML has no direct form for. That is why the @ prefix convention exists: @id: 7 becomes id="7" on the parent.
Check the result
After converting:
- Validate the XML with the XML validator.
- Adjust the layout with the XML formatter.
- Rename the root and item elements if the receiver is strict about names.
- Convert the other way with XML to YAML, or check the YAML first with the YAML validator.
A small example: YAML to XML
A YAML map with a key called server, holding host and port values, becomes a server element with host and port children. Add a key named @env with the value prod, and it becomes env="prod" on the server element. Lists of servers turn into repeated server elements.
Questions, answered
How do I convert YAML to XML?
Paste the YAML, set the root and item names, and copy the XML.
How do I write an XML attribute from YAML?
Start the key with @, for example @id.
Is my YAML config uploaded for conversion?
No. It is parsed and written out as XML by script in this tab, so settings with secrets stay on your device.
What happens to YAML lists?
Each item becomes an element with the same name.
What if my keys are not valid XML names?
They are changed to valid names, for example by replacing spaces with underscores.
Does this work on mobile browsers?
Yes. Paste the YAML in a current phone or tablet browser and copy the XML.