Xerobit

YAML to TOML Converter

Paste your YAML configuration to convert it to TOML format. The tool handles nested mappings, arrays, quoted and unquoted strings, numbers, booleans and dates. Everything runs locally in your browser so nothing is uploaded to any server.

Supports block mappings, sequences, flow collections, plain and quoted scalars, block scalars (| and >), and comments.

TOML Output

By · Published · How we build and test tools

How to use the yaml to toml converter

  1. Paste your YAML text into the input area.
  2. The converter automatically parses the YAML subset and generates TOML as you type.
  3. Copy the resulting TOML from the output area for use in your project.

How the conversion works

Converting yaml to toml requires mapping YAML's flexible structures to TOML's stricter rules. Top-level key-value pairs become simple key = value assignments. Nested YAML mappings translate to TOML table headers like [table]. When a YAML sequence contains mappings, the converter emits an array of tables using double brackets: [[array]].

Scalars are mapped by type. Unquoted integers and floats stay numeric. Booleans (true, false) map directly. Plain strings that could be misinterpreted as numbers or booleans are wrapped in double quotes. Block scalars using the literal style (|) preserve newlines, while folded style (>) replaces single newlines with spaces.

Supported YAML features

This converter implements a practical subset of YAML 1.2 designed for configuration files. It supports:

  • Block mappings (nested dictionaries)
  • Block sequences (arrays starting with -)
  • Flow sequences [a, b] and flow mappings {a: 1}
  • Plain, single-quoted and double-quoted scalars
  • Literal block scalars (|) and folded block scalars (>)
  • Comments starting with #

If you need to check your source syntax before converting, run it through a yaml lint tool first.

Unsupported features

To guarantee correct output rather than silently producing wrong data, several advanced YAML features are intentionally rejected with an explicit error message:

  • Anchors and aliases (&anchor, *alias): TOML has no reference mechanism, so these cannot be safely resolved without duplicating data in ways the user might not expect.
  • Tags (!!str, !custom): Custom type resolution is outside the scope of a static converter.
  • Merge keys (<<: *ref): These rely on anchors and are therefore unsupported.
  • Multi-document streams (--- separators): TOML represents a single document.

If your file uses these features, flatten it first or extract the relevant section.

Common use cases

The most frequent reason to convert yaml to toml is migrating project configurations. Many Rust tools (Cargo, rustfmt) and Go tools (Hugo) require TOML, while CI pipelines and Docker Compose use YAML. This converter bridges that gap quickly.

Another scenario is translating shared settings. A team might maintain a master configuration in YAML and generate TOML variants for specific microservices. Because this tool runs entirely in the browser, it is safe to use with sensitive credentials or internal paths without uploading them anywhere.

For other conversions, you might also need YAML to JSON or YAML to properties.

Reference: scalar mapping

YAML InputParsed TypeTOML Output
42Integer42
3.14Float3.14
trueBooleantrue
null, ~ or emptyNullKey left out (a note lists it)
helloString"hello"
'yes'String"yes"
2023-01-01Date string2023-01-01

TOML has no null type, so keys whose value is null are omitted from the output and the tool shows a note naming them. Integers are written as in the YAML but must fit in 64 bits (larger ones give an error), floats such as .5 or 5. are rewritten as 0.5 and 5.0 because TOML requires digits on both sides, and a plain date or timestamp that is a valid calendar date becomes a TOML date (a quoted one stays a string). Note that bare words like yes, no, on and off are treated as strings in YAML 1.2, unlike YAML 1.1 where they were booleans. This converter follows the 1.2 specification.

Worked examples

ExampleInputResult
Basic configYAML input: title: My App / version: 2 / debug: truetitle = "My App" / version = 2 / debug = true
Nested mappingYAML input: server: / host: localhost / port: 8080[server] / host = "localhost" / port = 8080
Array of tablesYAML input: packages: / - name: alpha / version: 1 / - name: beta / version: 2[[packages]] / name = "alpha" / version = 1 / [[packages]] / name = "beta" / version = 2

FAQ

Does this converter upload my data?

No. The entire yaml to toml conversion happens locally in your browser using JavaScript. Your configuration text is never sent to any server.

Why do I get an error about anchors or aliases?

TOML does not support references or pointers. To prevent generating incorrect output, the converter explicitly rejects YAML anchors, aliases, tags and merge keys instead of guessing how to inline them.

How are YAML arrays converted to TOML?

Simple arrays of scalars become TOML inline arrays like items = [1, 2, 3]. Arrays of mappings become TOML arrays of tables using the [[name]] syntax.

Are block scalars supported?

Yes. Literal blocks (|) preserve newlines exactly. Folded blocks (>) replace single newlines with spaces. Both are emitted as basic strings with escaped newlines in TOML.

What happens to YAML comments?

YAML comments are stripped during parsing because mapping them accurately to TOML positions is ambiguous. The resulting TOML will contain only the data structure.

Can I convert multiple YAML documents at once?

No. TOML represents a single document. If your YAML uses --- separators to define multiple documents, split them and convert each one individually.