b2KIT

YAML to TOML Converter

Convert YAML configuration files to TOML format and vice versa with structure preservation.

Tested tool guide Tested browser tools Checked August 16, 2026

What YAML to TOML Converter does, with a checked example

This converter maps configuration files between YAML and TOML in either direction: type or paste YAML into one pane and it writes the equivalent TOML in the other, or feed it TOML and read back YAML. Nested mappings become [table] headers, lists of mappings become [[array of tables]] blocks, and scalars are re-quoted and re-typed for the target format. Everything runs in the browser, so configs that contain API keys or tokens never leave your machine. The usual surprise: YAML supports things TOML has no syntax for - null values, anchors and aliases, mixed-type arrays - so a valid YAML file can fail or silently lose information.

Worked example

A concrete input and expected output from the current implementation.

Input

server:
  host: example.com
  port: 8080
  debug: true

servers:
  - name: alpha
    port: 8080
  - name: beta
    port: 9090

Expected output

[server]
host = "example.com"
port = 8080
debug = true

[[servers]]
name = "alpha"
port = 8080

[[servers]]
name = "beta"
port = 9090

The nested server map becomes a [server] table header, and the list of two server maps becomes two [[servers]] array-of-tables blocks: structure that YAML expresses purely by indentation becomes explicit headers in TOML. Strings are quoted, while integers and booleans are emitted bare.

How the result is produced

1

Parse, then re-emit

The converter reads the source document into a tree of scalars, mappings, and sequences, then serializes that tree in the target syntax, so output is generated from parsed data rather than from text substitution. Key order and nesting depth carry across, which is why a two-level YAML map returns as header blocks instead of a single inline line.

2

Mappings, lists, and scalars

A nested YAML mapping becomes a [table] header, and a list of mappings becomes [[array of tables]] headers with the entries repeated in order. Strings are re-quoted in the target's string syntax, integers and floats stay bare, and booleans are normalized to TOML's lowercase true and false. Keys containing dots or spaces must be quoted in the TOML output so they are not misread as dotted-key paths.

Good uses

  • Migrating a project's configuration when the stack switches from a YAML-based tool to a TOML-based one - for example porting application settings into a TOML config file without retyping each key and value.
  • Round-trip auditing: convert a config to TOML and back to YAML, then diff against the original to surface exactly what the conversion changed - nulls, aliases, and implicit typing are the usual casualties.
  • Learning TOML by example: convert a clean, well-formed YAML file and read the output as a worked model of table headers, arrays of tables, and quoting rules before hand-authoring TOML.

Limits and checks

  • YAML nulls cannot be represented. TOML has no null type, so null, ~, or a key with an empty value must be dropped, turned into an empty string, or rejected by the converter. If a key is missing from the output, the source probably held null; 'unset' and 'empty' are not the same thing after conversion.
  • Anchors and merge keys are expanded, not preserved. &name, *name, and the <<: merge key are YAML-only constructs; the converter copies the anchored value at every reference, which can visibly grow the file. Converting back yields plain repeated values, not the original anchors, so round-trips change shape even when the data is unchanged.
  • yes/no/on/off may not mean booleans. YAML 1.2 treats yes and no as plain strings, while YAML 1.1 parsers resolve them to booleans, so the converter may emit "yes" or true depending on which rules it follows. TOML itself accepts only lowercase true and false. Spot-check how these converted before trusting the rest of the output.

Common questions

Is the conversion lossless? Can I convert back and get my original file?

Not always. TOML-to-YAML is essentially lossless, but YAML-to-TOML drops whatever TOML cannot express: null values, anchors and aliases (expanded in place), explicit tags, multi-document streams split by ---, and mixed-type arrays, which TOML forbids. Round-trip your file and diff to see exactly what changed before trusting the output.

Why did a key disappear, or the converter complain, when my YAML had an empty value?

An empty value - key: with nothing after the colon - parses as YAML null, and TOML has no null type, so there is no faithful way to emit it. Converters typically drop the key, emit an empty string, or refuse with an error. If the empty value means 'unset', the key is simply omitted in TOML; if it matters, give it an explicit value first.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools