Skip to content
ZeroServer.tools

XML to TOML Converter

Convert XML configuration files to TOML format.

or drop a file here

Converted to 13 lines of TOML.

About XML to TOML Converter

Convert XML configuration files to TOML format instantly in your browser. Supports nested elements, repeated elements as arrays of tables, and automatic type detection for booleans and numbers — switch that off with Keep values as strings when a version like 1.0.0 or an ID with leading zeros must survive intact. Attributes are preserved as "@name" keys and an element's own text as "#text", so nothing in the source is dropped; keys that TOML cannot express bare — those, plus namespaced tags like soap:Body — are quoted automatically so the output always parses. No data leaves your device — all conversion runs entirely client-side.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Producing a TOML config from an XML source during a migration.
  • Converting legacy configuration for a modern tool.
  • Generating a TOML fixture from an XML document.
  • Comparing an XML config against a TOML one in the same shape.
  • Modernising a config format so it can be edited without namespace noise.

Frequently Asked Questions

What does not survive an XML to TOML conversion?
Attributes, namespaces, mixed content and comments — TOML has no representation for any of them. Attributes usually become ordinary keys, which loses the distinction XML draws between an attribute and a child element.
How do repeated XML elements convert?
Into an array of tables — `[[item]]` repeated once per element. That is the one part of the mapping that works well, because both formats can express a homogeneous list of records with the same fields.
What happens to types?
They have to be inferred, because XML has no types without a schema. A value of `8080` becomes a TOML integer and `"8080"` cannot be distinguished from it in the source — so the conversion guesses, and a version string like `1.10` becoming a float is the classic casualty.
Why is mixed content a problem?
Because TOML has no way to express text interleaved with child elements. `<p>Hello <b>world</b></p>` is natural XML and has no TOML shape at all — which is why this conversion suits data-oriented XML and fails on document-oriented XML.
When is this conversion appropriate?
Migrating configuration, essentially — an old XML config feeding a tool that now wants TOML. It is not a general document conversion, and the further the source is from a flat record structure, the less of it arrives intact.

Common errors and gotchas

  • Losing the attribute-versus-element distinction, which TOML has no way to express.
  • Producing keys from element names that are not valid TOML bare keys.
  • Ordering output so a table's keys no longer precede its sub-tables, which TOML requires.
  • Converting repeated elements inconsistently, where one child is not an array.
  • Dropping comments and mixed content, neither of which survives the structural change.

Related Converters tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate