GALAXY OF TOOLS

DEV SECTOR

YAML ↔ TOML Converter

Convert YAML to TOML and TOML to YAML, with JSON in between, dates, arrays of tables and line-numbered errors.

JSON (the common form both sides are converted through)

Conversion runs in your browser. Comments are dropped: neither parser keeps them, so add them back by hand if you need them.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Convert YAML to TOML and TOML to YAML without losing types

YAML and TOML describe the same kind of data — nested keys, lists, strings, numbers, booleans and dates — but tools disagree about which one they read. Hugo, Netlify, Cargo, Poetry and pyproject want TOML; Kubernetes, GitHub Actions, Docker Compose and Helm want YAML. This YAML to TOML converter moves a configuration between the two in either direction, keeps the types intact and shows the JSON it passes through so you can see exactly what was understood.

It is built for the awkward parts: TOML tables become nested YAML maps, YAML lists of maps become [[arrays of tables]] with their sub-tables, date-only, local and offset date-times survive as TOML dates rather than quoted strings, and multi-line YAML block scalars come out as """ strings instead of one long escaped line.

Parsing uses two open-source libraries loaded in your browser — js-yaml 4.1.0 (MIT) for YAML and smol-toml 1.9.1 (BSD-3-Clause) for TOML 1.0 — and the text never leaves your device.

How to use the YAML ↔ TOML Converter

  1. Choose the direction: YAML → TOML or TOML → YAML. JSON is valid YAML, so it can be pasted on the YAML side too.
  2. Paste the document into the input, drop a .yaml, .yml or .toml file on it, or press Load file — the direction follows the file extension. Sample loads a worked example for the current direction.
  3. Read the result on the right; it updates as you type. Any syntax error is reported with its line and column.
  4. Adjust the options: indent width for the YAML and JSON output, """ blocks for multi-line strings, dropping of null values (TOML has none) and sorted keys.
  5. Open the JSON panel to check how dates, numbers and nesting were interpreted, then Copy result or Download as .toml / .yaml.
  6. Press Swap to feed the result back in the other direction and confirm the round trip.

YAML ↔ TOML Converter features

Dates stay dates

TOML offset date-times, local date-times, local dates and local times are preserved. In YAML, an unquoted timestamp becomes a TOML date; a quoted one stays a string. A TOML local time has no YAML type, so it is written as a quoted string.

Tables and arrays of tables

Nested maps become [parent.child] headers; lists of maps become [[name]] entries, each followed by its own sub-tables. Lists of scalars and mixed lists stay inline. Keys that are not bare (my key, a.b) are quoted.

Multi-line strings

YAML block scalars (| and >) are written as TOML multi-line basic strings; TOML """ and ''' strings become YAML literal blocks.

Anchors, aliases and merge keys

YAML &anchor, *alias and <<: *merge are expanded before writing TOML, which has no equivalent.

Errors with line numbers

Bad indentation, a missing value, a duplicate key or a redefined table is reported as “line 12, column 5” with the parser’s own description.

JSON in the middle

The parsed data is shown as JSON — a third output, and the quickest way to spot a value read as a number when you meant a string.

How YAML and TOML values map to each other

YAMLTOMLNotes
key: value at the topkey = valueRoot must be a mapping — a YAML list or scalar cannot become TOML
Nested mapping[table.subtable]Headers are written only for tables that hold values of their own
List of mappings[[items]]Sub-tables follow their entry as [items.sub]
List of scalars / mixed list[1, "a", { k = 1 }]Inline arrays may mix types in TOML 1.0
2026-03-15 (unquoted)2026-03-15Local date; 2026-03-15 10:30:00 becomes a local date-time, a +05:30 suffix keeps the offset
"07:32:00"07:32:00TOML local times come back to YAML as quoted strings
null / ~— (dropped)TOML has no null; untick “Drop null values” to be told where they are instead
72.072JavaScript has one number type, so whole-number floats are written as integers
# comment— (dropped)Both directions discard comments; the converter tells you how many

Worked example: a Hugo menu

A YAML menu with a list of entries:

menu:
  main:
    - name: Home
      url: /
      weight: 1
    - name: Posts
      url: /posts/
      params: {icon: book}

becomes TOML arrays of tables, one [[menu.main]] per entry, with the inline params map written as a sub-table:

[[menu.main]]
name = "Home"
url = "/"
weight = 1

[[menu.main]]
name = "Posts"
url = "/posts/"

[menu.main.params]
icon = "book"

Things to check after converting

For JSON-specific needs use the YAML ↔ JSON Converter; to tidy the YAML side first, the YAML Formatter reports YAML 1.1/1.2 ambiguities such as unquoted yes and no. The JSON Formatter validates the JSON panel output if you copy it elsewhere.

  • Version numbers and IDs: YAML reads 1.10 as the float 1.1 and 0755 as 755 (YAML 1.2 core schema). Quote them in the source if they are strings.
  • Dates you meant as text: an unquoted 2026-03-15 becomes a TOML date. Wrap it in quotes to keep a string.
  • Comments and key order: comments are gone, and keys keep their original order unless Sort keys is on.
  • Large floats and integers beyond 253 lose precision in JavaScript; check them by eye.

YAML ↔ TOML Converter FAQ

How do I convert YAML to TOML?

Select YAML → TOML, paste the YAML or open the file, and read the TOML on the right. Copy it or download it as a .toml file. Nested maps become table headers and lists of maps become arrays of tables automatically.

Can it convert TOML to YAML and back without changes?

Yes for data: the selftest round-trips a TOML document through YAML and back and compares the parsed result, including the kind of each date. Formatting and comments are not preserved — the output is regenerated from the data.

Is TOML to JSON or JSON to TOML supported?

Yes. The JSON panel shows TOML-to-JSON for any TOML input, and because JSON is valid YAML, pasting JSON on the YAML side gives JSON-to-TOML.

Why did my null values disappear?

TOML has no null type. By default null values are dropped and a note tells you how many. Untick “Drop null values” and the converter reports the exact key instead so you can decide what to do.

Which TOML version is supported?

TOML 1.0.0, parsed by smol-toml 1.9.1 — including dotted keys, inline tables, arrays of tables, all four date-time forms, multi-line basic and literal strings, and hexadecimal, octal and binary integers. Comments are parsed and discarded.

Is my configuration uploaded?

No. Both parsers run in your browser; the only network requests are the one-time CDN downloads of js-yaml and smol-toml. Secrets in a config file stay on your device.

You might also need