TOML to YAML Converter

Paste TOML, key/value pairs, `[table]` sections, and `[[array of tables]]` sections, and get back the equivalent nested YAML document, covering the common subset most real-world TOML config actually uses. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

TOML's table syntax reads well for hand-written config, but a lot of tooling, CI pipelines, orchestration platforms, documentation generators, standardizes on YAML instead. This tool parses TOML's common syntax and re-expresses it as nested YAML.

It's a hand-written parser covering the TOML features most real config files actually use: scalar values, nested tables, and arrays, deliberately excluding the format's more exotic corners in favor of clear errors when it hits something outside that subset.

What Is TOML to YAML Converter?

A TOML-to-YAML converter reads TOML source line by line, tracking which table (or array-of-tables) each subsequent `key = value` pair belongs to, and builds a single nested JavaScript object representing the whole document.

That object is then serialized as YAML with the same stringifier every other tool in this category uses, so the result matches this site's usual formatting conventions.

How TOML to YAML Converter Works

Each line is checked in order: `[[path]]` headers push a new table onto an array at that path and make it the current table; `[path]` headers navigate to (creating if needed) a nested table and make it current; `key = value` lines set that key on the current table after the value is parsed according to TOML's grammar for strings, numbers, booleans, and arrays.

Comments, both whole-line and trailing, are stripped before parsing, using a quote-aware scan so a `#` inside a string literal isn't mistaken for a comment marker.

When To Use TOML to YAML Converter

Use it when migrating a Cargo.toml-, pyproject.toml-, or similar-style config into a YAML-based system.

It's also useful for quickly checking what a TOML config's nested structure looks like once flattened into YAML's indentation-based syntax.

Features

Advantages

  • Handles the TOML features most real config files use: tables, arrays of tables, and typed scalars.
  • Reports clear, line-numbered errors for anything outside the supported subset rather than silently misparsing it.
  • Correctly reconstructs repeated `[[array of tables]]` headers into a proper YAML sequence.
  • Runs entirely client-side with no added dependency, so configuration data never leaves your browser.

Limitations

  • Inline tables (`{a = 1, b = 2}`), multi-line strings, literal strings with triple quotes, and TOML's native date/time types are not supported and produce a parse error.
  • Dotted inline keys (`a.b = 1` as shorthand for a nested table on one line) are rejected in favor of the more common explicit `[table]` header style.
  • Array parsing handles nested arrays and quoted strings but doesn't implement TOML's full string-escaping grammar beyond what's compatible with JSON-style escaping.

Examples

A table section

Input

[config]
debug = false

Output

config:
  debug: false

The table header becomes a nested YAML mapping.

Repeated array-of-tables headers

Input

[[servers]]
name = "web-1"

[[servers]]
name = "web-2"

Output

servers:
  - name: web-1
  - name: web-2

Each `[[servers]]` repetition becomes one more item in the YAML sequence.

Unsupported dotted inline key

Invalid input

a.b = 1

Parser error

Line 1 has an unsupported key ("a.b"); dotted inline keys are not supported.

Rather than guessing at the intended nesting, the parser reports this TOML shorthand as outside the supported subset.

Corrected version

[a]
b = 1

Best Practices & Notes

Best Practices

  • Prefer explicit `[table]` headers over dotted inline keys in your source TOML if you plan to convert it with this tool.
  • Check the error message's line number directly against your TOML source when something fails to parse, it points at the exact line that didn't fit the supported subset.
  • Run the result through the YAML Formatter afterward if you want to double-check indentation consistency.

Developer Notes

The parser is hand-written and line-oriented (no TOML library dependency), tracking a 'current table' reference that table and array-of-tables headers reassign. Quote-aware helper functions handle comment stripping, top-level comma splitting for arrays, and finding the key/value separator, so that `#`, `,`, and `=` characters inside string values don't get mistaken for syntax.

TOML to YAML Converter Use Cases

  • Migrating a Cargo.toml or pyproject.toml-style config into a YAML-based deployment pipeline
  • Converting TOML application config into YAML for a framework that expects it
  • Previewing a TOML file's nested structure as YAML during a format migration
  • Generating YAML fixtures for tests from an existing TOML source

Common Mistakes

  • Using dotted inline keys (`a.b = 1`) and expecting them to work, use an explicit `[a]` table header with `b = 1` underneath instead.
  • Assuming TOML date values convert to a YAML date type, they don't; the current subset doesn't parse native TOML dates at all and reports them as unsupported.
  • Forgetting that `[[array of tables]]` headers must repeat once per array item; a single `[[servers]]` header only ever produces a one-item array.

Tips

  • If parsing fails, check whether the offending line uses a TOML feature (inline table, multi-line string, dotted key) explicitly called out as unsupported.
  • Use YAML to TOML afterward to sanity-check a round trip if you need to confirm nothing was lost for a specific document.
  • For config with many small tables, converting to YAML often makes the overall nesting easier to see at a glance than TOML's flat header style.

References

Frequently Asked Questions