CruxDevCruxDev Tools Prompts
dev Utility • Zero-Server Privacy • 100% Client-Side

YAML ↔ TOML Converter

Convert between YAML and TOML configuration formats while preserving comments, types, and nested structure.

Overview

Convert a YAML configuration file into TOML. Scalars map to TOML values, nested mappings become tables, and arrays become inline arrays. Parsing uses a standard YAML library in your browser, with errors reported as TOML comments in the output.

How It Works

Edit the sample YAML or paste your own on the left; the TOML appears on the right as you type. The input must parse to a mapping at the top level, otherwise the output explains that requirement. Both panels include download buttons, and clicking either editor copies its contents. Strings, booleans, and numbers keep their YAML types through the conversion.

Step-by-Step Usage Guide

  1. Paste the YAML document into the left editor.
  2. Check that the top level is a mapping; the output explains if it is not.
  3. Read the TOML output, with table sections after the scalar keys.
  4. Copy the TOML or download it as a config file.

Technical Specifications & Standards

The conversion runs a real YAML parser locally, so anchors and aliases resolve to their values, quoting controls types, and the parser's error messages surface verbatim when the syntax is broken. The TOML serializer then applies the same structure rules as the site's JSON-to-TOML tool, because YAML is parsed into the same shape first: top-level scalars and arrays become key = value lines, top-level mappings become [table] sections, and nesting is handled to exactly two levels. A mapping nested inside a table, or an array of mappings, is written as a JSON string in the value position rather than as nested tables, so restructure such documents before converting if you need true TOML tables. TOML 1.0 has no null, so a YAML null becomes the quoted string "null". Keys are written unquoted, which means a YAML key containing a dot would be read as a dotted key by TOML parsers, and a key with a space would be invalid. Types carry over faithfully: quoted 8080 stays a string, unquoted becomes an integer.

Targeted Use Cases

  • Migrating CI or application settings from YAML to a TOML-based tool.
  • Converting Docker Compose-style fragments for documentation examples.
  • Translating a Kubernetes-adjacent YAML config into TOML for a Rust or Python project.
  • Comparing YAML and TOML side by side when choosing a format.

Notes & Gotchas

  • Keep nesting to two levels so every value maps to real TOML tables rather than stringified JSON.
  • Quote values that must remain strings, such as version numbers and port-like codes.
  • Rename keys containing dots or spaces before converting.
  • Replace null values with explicit defaults, since TOML cannot represent null.

Frequently Asked Questions

Why did my nested mapping become a quoted string?

The serializer handles one level of tables. A mapping inside a table is written as a JSON string in the value position, which is valid TOML but not a nested table. Flatten the YAML or promote the section to the top level.

How are YAML anchors and aliases converted?

The parser resolves them before conversion, so an alias contributes the same value as its anchor, and the TOML output contains the resolved values with no anchor syntax.

What happens to YAML nulls?

TOML has no null value, so null becomes the quoted string "null", which reads back as text. Replace nulls with empty strings, zeros, or omit the key.

Does the top level have to be a mapping?

Yes. A document whose root is a list or scalar is rejected with a comment explaining that the input must parse to an object, since TOML documents are key-value structures at the top level.