TOML to YAML

Translate TOML documents into YAML with optional key sorting and indentation control.

Translate TOML documents into YAML with optional key sorting and indentation control. Translate TOML documents into YAML with optional key sorting and indentation control.

Output

Background

Why move between TOML and YAML

Both formats target human-edited configuration files, but the ecosystem around them is different. TOML is the standard for Python packaging (pyproject.toml), Rust (Cargo.toml), GitHub workflows and many CLI tools. YAML is the standard for Kubernetes, Ansible, Docker Compose, GitHub Actions (the older syntax), and many CI systems.

Sometimes you need to express the same configuration in both formats: re-using a pyproject.toml snippet inside an Ansible playbook, or transcribing a Kubernetes ConfigMap into a Cargo.toml dependency block. A TOML-to-YAML converter keeps the translation mechanical.

What survives the conversion

Mappings, sequences, scalars (strings, integers, floats, booleans, ISO dates), inline tables, and dotted keys all translate cleanly. Multi-line strings are emitted as YAML block scalars, preserving the visual layout the original TOML author chose.

What does not

YAML tags (!!str, !!int, etc.) are emitted only when the underlying type differs from YAML's default inference. In practice the parser's choice matches what most readers expect. YAML anchors are not produced by default because every TOML value is fully self-contained; if you want shared sub-trees, introduce them by hand.

Workflow tips

After conversion, run the YAML through a linter (yamllint, kubeconform) before committing. The converter translates syntax, not style: it cannot know whether you intended the file to follow snake_case or kebab-case, or whether you wanted 2-space or 4-space indent. Your project conventions decide that.

Built around two MIT/BSD-3 libraries bundled in public/assets: smol-toml for parsing and js-yaml for emission. Your input stays on this page.

Frequently asked questions

Does the converter support TOML arrays of tables?
Yes. `[[name]]` headers become YAML sequence elements under the `name` key, preserving the table ordering.
Will the YAML output keep my TOML comments?
No. TOML comments are stripped by the parser. Add comments back by hand in the YAML output if needed.
How are TOML dates represented in YAML?
Dates and datetimes become YAML strings with the same ISO representation. Most YAML consumers parse them with their language's date library.
What about TOML's inline tables?
They become nested YAML mappings on a single line. Some style guides require block style for readability; convert manually if your linter complains.
Why does the output use double quotes around strings?
YAML single-quoted strings forbid escape sequences and YAML plain scalars have reserved keywords; double quotes are the safest default for round-tripping arbitrary text.
Is my TOML uploaded?
No. Parsing happens locally via smol-toml and YAML emission via js-yaml. Nothing is sent to a server.