ToolFeather
Developer / SEORuns in your browser

YAML to XML Converter

Convert YAML configuration or data to XML: maps become nested elements, lists repeat their parent element, and keys that start with @ become attributes.

Quick presets

YAML to XML Converter

YAML
XML

Runs in your browser — nothing you enter is uploaded or stored.

ToolFeather · YAML → XML
Scratchpad auto-saved
Stored in this browser (localStorage)
Step-by-step~40s read

How it works — in four simple steps

No signup and nothing to install — it all runs in your browser.

1

Add your YAML

Paste it into the left box, press Open file, or drag a .yaml file onto it. Sample loads a realistic example.

2

Set the options

Adjust the options above the boxes — the output updates instantly as you change them.

3

Check the result

Read the status line: it reports rows, keys and any value that couldn't be represented in XML.

4

Copy or download

Copy the XML or download it as a .xml file. Nothing was uploaded at any point.

Pro tip

Quote keys that start with @ in YAML ("@id": 7) — they become XML attributes.

Features

Your element names

Set the root element and the name used for each array item, and invalid characters are fixed for you so the XML stays well-formed.

Attributes kept, clearly marked

XML attributes become keys with an @ prefix (or _ / - / none), so they never collide with child elements of the same name.

Declaration on demand

Include or omit the <?xml version="1.0" encoding="UTF-8"?> line.

CDATA when you want it

Text containing < or & can be wrapped in CDATA sections instead of being escaped.

Private by design

Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.

About the YAML to XML Converter

YAML and XML are both hierarchical, which makes this conversion predictable. Every YAML mapping key becomes an element and its value becomes the element's content; a nested mapping becomes nested elements. A YAML sequence under a key repeats that key's element once per entry, so ports: [80, 443] becomes two <ports> elements — the same rule XML-to-YAML uses in reverse.

The YAML is read with a block-style parser that understands indentation, comments (#), quoted strings, inline lists and maps ([a, b], {k: v}), multi-document files separated by ---, and block scalars (| keeps line breaks, > folds them). Anchors, aliases and custom tags (&base, *base, !!binary) aren't supported — expand them first if your file uses them.

Because XML needs a single root, a YAML file with one top-level key uses that key as the root; anything else is wrapped in the root element you choose. YAML comments are not carried over: they belong to the YAML syntax, not to the data, so no parser exposes them.

Examples

A service configuration with a nested map, a list of ports and a multi-line message.

YAML input
service:
  "@version": 2
  name: billing-api
  replicas: 3
  ports:
    - 8080
    - 8443
  env:
    LOG_LEVEL: info
    REGION: ap-south-1
  motd: |
    Maintenance window:
    Sundays 02:00-03:00 IST
XML output
<?xml version="1.0" encoding="UTF-8"?>
<service version="2">
  <name>billing-api</name>
  <replicas>3</replicas>
  <ports>8080</ports>
  <ports>8443</ports>
  <env>
    <LOG_LEVEL>info</LOG_LEVEL>
    <REGION>ap-south-1</REGION>
  </env>
  <motd>Maintenance window:
Sundays 02:00-03:00 IST
</motd>
</service>

This output was produced by the converter on this page with the default options — load it with the “Service config” preset above and change any option to see the effect.

How YAML maps to XML

In YAMLBecomes in XML
name: app<name>app</name>
Nested mappingnested elements
ports: [80, 443]<ports>80</ports><ports>443</ports>
"@version": 2attribute version="2"
Block scalar |element text with the line breaks preserved
~ or nullempty element
# commentdropped (comments aren't data)

Things that trip people up

YAML vs XML at a glance

PropertyYAMLXML
SpecificationYAML 1.2.2 (2021)XML 1.0 Fifth Edition (W3C, 2008)
File extension.yaml / .yml.xml
Media typeapplication/yaml (RFC 9512)application/xml (RFC 7303)
Data typesstring, int, float, bool, null, map, sequence (+ dates in many parsers)text only (types come from a schema)
CommentsYes #Yes <!-- -->
NestingUnlimited (indentation)Unlimited

Frequently asked questions

5 answers
What happens to YAML lists in XML?
Each list entry repeats the parent key as an element. A top-level list is wrapped in the root element with one item element per entry.
Can I create XML attributes from YAML?
Yes — quote a key that starts with @, like "@id": 7, and it becomes an attribute of the parent element.
Are YAML comments kept?
No. Comments are part of YAML syntax rather than the data, so they aren't available to carry over. Add XML comments by hand if you need them.
Does it support multi-document YAML?
Yes. Several documents separated by --- become an array, which is wrapped in the root element with one item element per document.
Is my data uploaded anywhere?
No. The YAML is parsed and converted by JavaScript in your browser tab; nothing is sent to a server, so it is safe for internal exports, customer lists and configuration files with secrets.