YAML to TOML

Migrate a YAML config to TOML.

Reverse
Input
YAML input
Output
Result

About this tool


Both YAML and TOML are human-written config formats, and this conversion is usually part of a deliberate migration, moving a project onto pyproject.toml, or adopting TOML because its parsing rules are less surprising than YAML's implicit typing.

YAML is the more expressive of the two, so this direction is where things get dropped: comments, anchors, multiple documents and null values all have no TOML equivalent.

How to use it

  1. Paste or upload YAMLThe top level must be a mapping, since TOML documents are tables.
  2. ConvertPress Convert to TOML, or use Ctrl+Enter.
  3. Review the warningsThey list anything that could not be represented, particularly dropped nulls.
  4. Copy or downloadSave as .toml or copy the output.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

Nested YAML mapping

Input

title: My App
owner:
  name: Ada
  age: 36

Output

title = "My App"

[owner]
name = "Ada"
age = 36

The indented mapping becomes an [owner] table header.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

Indentation becomes table headers
YAML expresses nesting with indentation; TOML uses bracketed headers. A nested mapping two levels deep becomes a [parent.child] header, so the output is visually flatter than the input even though the structure is identical.
null values are dropped
YAML has null (written as null, ~, or simply an empty value), and TOML has no equivalent. Those keys are omitted, with a warning. Because a bare YAML key with nothing after it is already null, it is easy to lose keys you did not realise were empty, read the warning.
Comments and anchors do not survive
YAML comments are discarded. Anchors and aliases are expanded into full copies before writing, so shared blocks become duplicated text, the config still behaves the same but is longer and no longer shows the relationship.
Type handling is stricter
TOML requires arrays to be homogeneous in older versions, so a YAML list mixing strings and numbers may not be representable. TOML also has no equivalent of YAML's complex keys, and requires strings to be quoted, which removes the implicit-typing ambiguity that makes YAML error-prone.

Limitations


  • null values are dropped, since TOML has no null type.
  • Comments, anchors and multiple documents are not preserved.
  • Mixed-type arrays may not be representable in older TOML versions.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


Why is my output flatter than the input?
TOML represents nesting with bracketed table headers rather than indentation, so deep structures appear as a sequence of [a.b.c] sections. The data is identical.
Which YAML features cannot be converted?
Comments, anchors and aliases, multiple documents, null values, complex keys and custom tags. Nulls are the one most likely to affect you, so the tool warns when any are dropped.