YAML to TOML Converter

Paste YAML and get back TOML: scalar key/value pairs, `[table]` sections for nested mappings, and `[[array of tables]]` sections for arrays of objects, covering the common subset both formats share. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

TOML has become a common choice for tool configuration (Cargo.toml, pyproject.toml) precisely because its table syntax reads clearly for config files, while YAML remains the default for CI and orchestration. When you need to move a config from one to the other, this tool automates the common cases.

It covers scalar values, nested tables, and arrays (both of plain values and of objects), the parts of both formats that overlap cleanly, and is upfront in its output about the one thing that doesn't translate: null values.

What Is YAML to TOML Converter?

A YAML-to-TOML converter walks a parsed YAML document and renders it as TOML source text: simple key/value pairs at the top of each section, followed by `[table]` headers for nested mappings and `[[array of tables]]` headers for arrays of mappings, in the order TOML requires.

Because TOML's grammar is stricter and more explicit than YAML's, the converter has to make a few decisions YAML leaves implicit, most notably that null values simply have no TOML representation.

How YAML to TOML Converter Works

The YAML input is parsed into a plain value with the same parser used by every tool in this category. That value is then walked recursively: each object's simple scalar and array-of-scalar entries are written first, then its nested-object entries become `[table]` sections, then its array-of-object entries become repeated `[[array of tables]]` sections, since TOML requires that ordering within each level.

Strings are rendered as double-quoted TOML basic strings via `JSON.stringify`, which shares TOML's core escaping rules for backslashes, quotes, and common control characters closely enough for this common subset.

When To Use YAML to TOML Converter

Use it when migrating a project's configuration from a YAML file to a TOML-based tool (like moving CI variables into a `pyproject.toml` or `Cargo.toml`-style file).

It's also useful for quickly previewing how a YAML document's structure maps onto TOML's more explicit table syntax.

Features

Advantages

  • Correctly orders scalars, tables, and arrays of tables the way TOML's grammar requires.
  • Handles arbitrarily nested mappings via dotted table headers.
  • Clearly documents any information that couldn't be represented (null values) instead of silently dropping it.
  • Runs entirely client-side with no added dependency, so configuration data never leaves your browser.

Limitations

  • Null values have no TOML equivalent and are omitted, with a summary comment listing what was dropped.
  • TOML-specific features this converter doesn't emit include inline tables, multi-line/literal strings, and native date-time types, YAML dates and multi-line scalars are converted to their plain string form instead.
  • Very large arrays of arrays of tables (a TOML edge case) aren't specially handled beyond the standard `[[array of tables]]` form, which covers the common case but not every nested variant.

Examples

Scalars and a nested table

Input

name: api
config:
  debug: false

Output

name = "api"

[config]
debug = false

The top-level scalar `name` is written before the `[config]` table header, matching TOML's required ordering.

An array of objects becomes array-of-tables

Input

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

Output

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

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

Each object in the sequence gets its own repeated `[[servers]]` header.

Best Practices & Notes

Best Practices

  • Review the output's omitted-value comment (if present) before relying on the converted file, since silently missing keys can break config loaders that expect them.
  • Format the source YAML first if it's in flow style, so the resulting TOML's structure is easier to eyeball against the original.
  • For deeply nested config, expect long dotted table headers, that's TOML's own convention for representing depth, not an artifact of this converter.

Developer Notes

The serializer is hand-written (no TOML library dependency), splitting each object's entries into simple values, nested tables, and arrays-of-tables buckets, then emitting them in that order recursively. String escaping reuses `JSON.stringify`, which is compatible with TOML's basic string escaping for the common ASCII and \uXXXX cases this converter targets.

YAML to TOML Converter Use Cases

  • Migrating CI or build configuration from YAML into a TOML-based tool's config file
  • Converting a Kubernetes-style values file into TOML for a Rust or Python project's config
  • Previewing how a nested YAML document's structure maps onto TOML's table syntax
  • Generating TOML fixtures for tests from an existing YAML source

Common Mistakes

  • Assuming null values survive the conversion, they don't; check the omitted-value comment at the top of the output.
  • Expecting inline tables (`{a = 1}`) in the output, this converter always uses full `[table]` sections instead.
  • Forgetting that TOML requires all of a table's simple keys before its subtables; if you hand-edit the output, keep that ordering intact.

Tips

  • If your YAML has date-like strings, check the converted TOML: they'll come through as quoted strings rather than TOML's native date type.
  • Use Toml to YAML afterward to sanity-check a round trip if you need to confirm nothing was lost for a specific document.
  • For very large documents, consider running Truncate YAML first to get a smaller sample to preview the conversion on.

References

Frequently Asked Questions