About TOML to YAML
Converting TOML to YAML usually happens when one configuration must be reused across two toolchains: one preferring explicit section headers, the other preferring indentation-based hierarchy. Moving it by hand invites mistakes around nested arrays and inline tables, so a converter is safer. Conversion parses TOML into a tree and emits YAML. TOML declares paths through section headers, so the resulting hierarchy can be deeper than the source suggests. In YAML those levels become indentation, and a single misplaced indent changes meaning, which is exactly what needs human review after an automatic conversion. Practical notes: Compare three levels afterwards: the number of top-level keys, the number of keys under each, and array element counts. Agreement there is good evidence the structure survived. Date and time are first-class in TOML but may stay a timestamp type or become a string in YAML depending on the serializer, so quote explicitly when a downstream consumer expects text. Inline and standard tables are written differently in TOML yet mean the same thing, and normalizing them into one YAML form exposes inconsistencies that were hiding in the source. Limits: TOML keys may contain dots to express hierarchy and YAML allows the same, which is ambiguous in certain cases, so wrap the whole key in quotes when a key itself contains a dot. Comments cannot be preserved, a capability difference between the formats. TOML also does not permit a top-level array, so an array-rooted source cannot be represented at all and conversion fails or requires a wrapper key; when that happens, first confirm the source is valid TOML rather than doubting the converter. Data and privacy: such configuration usually holds secrets and credentials. This tool converts in the browser, uploads nothing and works offline. For production configuration, convert locally and keep both source and result under version control so changes stay traceable. In team settings the argument format conversion triggers most is which one to use at all. The pragmatic answer follows the consumer: choose the more expressive, comment-friendly format for configuration people edit by hand, the one with strict structural boundaries for configuration machines read heavily, and bridge them with a conversion script rather than forcing everyone onto one format. The script itself belongs under version control with a few sample files as tests, so later changes to the conversion strategy surface regressions immediately instead of being traced back after a production incident. To get going, validate the output on a smaller configuration that already contains nested tables and arrays, checking that the hierarchy matches intuition, and only then process the full file. For maintenance, keep a short before-and-after note in the repository describing which fields are converted automatically and which were adjusted by hand. So a newcomer editing configuration does not assume the hand-tuned parts will survive a regeneration, which removes the confusion of "my change disappeared after regenerating". Finally, keep the conversion script and its sample data in the repository with the applicable version documented, so whoever upgrades the toolchain knows where verification starts.
How It Works Internally
The reverse direction also builds a tree and serialises it, but note that headers can imply a deeper hierarchy than the text suggests: a.b.c = 1 and nested headers describe the same level. Date and time are first-class in TOML yet may stay a timestamp or land as a string in YAML depending on the serializer, so quote explicitly when a consumer expects text.
[server.http]
port = 8080server:
http:
port: 8080 (equivalent to server.http.port = 8080)Measured on This Page
| Baseline before | 5 of 13 were wrong: dotted key a.b.c became the literal key "a.b.c", multiline strings returned empty, 1_000/0x1f/0o17/0b1010 all became 0, inf became the string "inf", -inf became null, and inline tables became strings |
|---|---|
| After the fix | All 13 match tomllib exactly (object-level comparison) |
| What changed | Dotted keys expand into nested tables; """ and ''' multiline strings (with line-continuation backslash and \u escapes); underscores and 0x/0o/0b prefixes in numbers; inf/nan; inline tables |
| Invalid input | Duplicate keys, unclosed strings and redefined tables now report TOML parse failure with line and column instead of emitting partial output |
| Date-times | Values like 1979-05-27T07:32:00Z stay as strings — JSON has no date type, and object conversion would lose information |
The common thread of these bugs was silently producing wrong values: 1_000 became 1 and 0x1f became 0, and the resulting YAML looks perfectly valid, so the user receives wrong data instead of an error. The parser now reports anything it cannot parse with a line/column reference — a converter should refuse rather than emit a plausible-looking lie. Dates staying as strings is deliberate: if you want the ISO string it is already there. The parser is hand-written for its teaching value, so exotic TOML 1.0 corners are decided against tomllib's behaviour and fail loudly rather than guessing.
How to Use
- Open "TOML to YAML"
- Paste the TOML config
- YAML is generated live
- Check that table headers became indented mappings
- Click the copy icon to export the YAML
Use Cases
- Cross-ecosystem migration — Move config ideas from a Rust TOML setup into YAML-based deployment manifests.
- Unify team format — Batch-convert legacy configs when a team switches from TOML to YAML.
- Learn by comparison — See one config in both TOML and YAML to understand each syntax's trade-offs.
- Generate CI config — Convert parameters organized in TOML into the YAML GitHub Actions expects.
- Improve readability — Convert when deep nesting reads better as YAML indentation than TOML dotted paths.
- Kubernetes config prep — Convert TOML-based app settings into YAML for a ConfigMap or Helm values file.
- Documentation parity — Show the same config in both TOML and YAML forms in docs for readers familiar with either format.
FAQ
Is information lost in conversion?
Almost none. TOML and YAML data models are highly compatible — scalars, arrays, tables all map directly. Only TOML comments are lost.
How do TOML dates appear in YAML?
TOML RFC 3339 dates become YAML timestamp literals, a type YAML supports natively.
How are arrays of tables shown?
TOML [[table]] becomes a YAML list (a sequence of objects prefixed with -).
Why does my TOML fail to parse?
Common causes: unquoted special characters in keys, mismatched string quotes, or duplicate keys in the same table.
Are inline tables expanded?
Yes, into normal table structure. A single-line inline table like { a = 1 } becomes a multi-line key-value mapping in YAML with unchanged semantics.
Want JSON first?
Use the TOML to JSON tool — JSON makes a more universal intermediate format.
The indentation style differs from my project?
YAML accepts 2 or 4 spaces and the tool emits one style; parsing is unaffected. Run your project formatter rather than hand-editing — manual indentation is the most common way to break deep nesting.
Keys with special characters got quoted?
YAML requires quoting for keys starting with special characters or containing colons; the tool follows the spec. If a downstream system rejects quoted keys, that is a non-standard parser — fix the parser, not the quotes.