T tomlkit·org
Inspect Formatter Validator Convert TOMLJSON JSONTOML TOMLYAML YAMLTOML INITOML TOMLINI .envTOML TOML.env TOMLTS Transform Sort keys Flatten Minify Compare Diff Merge

TOML to YAML Converter

updated 8 June 2026

Paste TOML on the left, get YAML 1.2 on the right. Entirely in-browser — no upload, no server round-trip.

YAML 1.2 · ISO dates

What this tool does

It parses a TOML 1.0 document into a value tree, then serializes that tree as YAML 1.2 with js-yaml. Tables become mappings, arrays-of-tables ([[servers]]) become sequences of mappings, and scalars carry across with their types intact. Datetimes are written as ISO 8601 strings.

The intent it closes: "I have a config in TOML and the platform I'm deploying to only speaks YAML." The destinations are almost always operational: a Kubernetes manifest, a GitHub Actions workflow, a Docker Compose file, a Helm values.yaml, an Ansible playbook, or a Home Assistant config.

One thing to know going in: comments don't survive. The tool parses to a tree and re-emits, and the tree carries no # comments — so any notes in your TOML won't appear in the YAML.

When you'd reach for it

  • Move a Rust or Go config into CI. Take a Cargo.toml-style settings block and drop it into a GitHub Actions or GitLab CI workflow that expects YAML.
  • Feed Kubernetes or Helm. Convert a hand-written TOML config into a manifest or values.yaml without retyping the hierarchy.
  • Switch boolean spelling for older loaders. Flip Booleans to yes / no when a YAML 1.1 consumer expects those words.
  • Collapse small structures. Use All inline or Inline ≥ depth 2 to get compact flow-style YAML for short configs.
  • Alphabetize keys on the way out. Pick Alphabetical sort for a stable, scannable manifest.
  • De-duplicate repeated blocks. Turn Anchors on so repeated mappings emit as &anchor / *alias instead of being written out twice.

How the conversion works

One click of Convert runs three stages.

1. Parse the TOML

The full TOML 1.0 grammar is parsed into a value tree — dotted keys collapse into nested tables, datetimes become date-shaped values, integers keep their numeric type. A parse failure shows in the status bar and produces no output.

2. Normalize dates

TOML datetimes are converted to ISO 8601 strings before serialization. YAML 1.2 has no mandatory date type, so a string is the lossless choice — most loaders recognize an ISO string and can cast it back to a date if they want one.

3. Serialize to YAML

js-yaml dumps the tree using the Indent, Style, Sort, and Anchors options. If Booleans is set to yes / no, a final text pass rewrites true/false tokens that sit in value position (after : or -) to yes/no — it deliberately leaves words inside quoted strings alone.

Options reference

Indent

Spaces per nesting level — 2 (the YAML norm and what most linters expect) or 4. It changes only indentation width, never structure.

Style

Block (multi-line) writes every mapping and sequence on its own indented lines — the readable default for manifests. All inline collapses collections to flow style on single lines ({a: 1, b: 2}, [1, 2, 3]). Inline ≥ depth 2 keeps the top of the document in block style and only switches deeper, nested collections to inline — compact leaves, readable top level.

Sort

Preserve keeps TOML key order. Alphabetical sorts mapping keys A–Z, which makes a large manifest diff-stable and easy to scan by eye.

Anchors

off (noRefs) writes every value out in full, even if the same object appears twice. Use &anchor / *alias lets YAML factor repeated mappings into a single anchored definition referenced by alias — smaller output, but some strict loaders dislike anchors, so it's off by default.

Booleans

true / false is standard YAML 1.2. yes / no (1.1) rewrites booleans to the older spelling some tools still expect. The rewrite only touches tokens in value position and never alters text inside quoted strings.

Output and mapping rules

  • Tables → mappings. [owner] becomes a nested mapping under owner:.
  • Arrays-of-tables → sequences of mappings. [[servers]] blocks become a servers: sequence with one mapping each.
  • Dotted keys resolve to the same nested structure they denote in TOML.
  • Datetimes → ISO 8601 strings. No data is lost; cast back in your loader if needed.
  • Comments are not carried through — parse-and-re-emit drops them.
  • Encoding: UTF-8. Download: output.yaml, content type text/plain;charset=utf-8.

Example

Input (TOML):

[database]
server = "192.168.1.1"
ports = [8000, 8001, 8002]
enabled = true

[[users]]
name = "Alice"
role = "admin"

[[users]]
name = "Bob"
role = "user"

Output (YAML, defaults — 2-space indent, Block style):

database:
  server: 192.168.1.1
  ports:
    - 8000
    - 8001
    - 8002
  enabled: true
users:
  - name: Alice
    role: admin
  - name: Bob
    role: user

The [[users]] arrays-of-tables become a single users: sequence of mappings — the idiomatic YAML shape for a list of records.

Recipes by intent

Make a Kubernetes-ready manifest

Keep Style on Block, Indent on 2. That's the layout kubectl and almost every YAML linter expect — multi-line, two-space, no flow collapsing.

Satisfy an older YAML 1.1 loader

Set Booleans to yes / no. Tools built on YAML 1.1 (some Ruby and legacy Python stacks) read yes/no as booleans; this writes them that way without touching string content.

Shrink a config full of repeated blocks

Turn Anchors on. Repeated mappings are written once as &anchor and referenced as *alias afterwards — useful for a values file with many near-identical entries.

Produce a compact one-liner config

Choose All inline. Collections render in flow style ({…}, […]), handy for a short config you want to paste into a single field.

Limits and performance

  • In-memory. Input, parsed tree, and YAML output coexist in memory. Config-sized files convert instantly; a multi-megabyte TOML can hang the tab for a second while the YAML string is built.
  • Comments are not preserved. Keep your TOML as the source of truth and convert a copy.
  • The textarea is the slow part on big output. Tens of megabytes paint slowly into the pane — prefer Download .yaml over Copy.
  • Anchors can trip strict loaders. If your target rejects &/*, leave Anchors off.

Errors and how to fix them

Status bar goes red on click / a parse error

The input isn't valid TOML 1.0 — usually an unclosed quote, a mismatched [[…]] array-of-tables header, a missing =, or a duplicate key. The TOML Validator points at the exact line and column.

My # comments are gone

Expected. The parser builds a value tree with no comment nodes, so the YAML emitter has nothing to write. Keep the original TOML if the comments matter.

The YAML indentation isn't what my tool wants

Switch Indent between 2 and 4. If a tool needs something more exotic, run the output through that tool's own formatter after copying.

A multi-line string looks different in YAML

TOML and YAML express multi-line text differently (triple-quotes vs. block scalars). The emitter picks a valid YAML representation; the string content is identical even when the surrounding syntax changes.

FAQ

Why convert TOML to YAML at all?

Ecosystem fit. A project may author config in TOML but deploy to a platform that only reads YAML — Kubernetes, Helm, Docker Compose, GitHub Actions, Ansible, Home Assistant. This bridges the two without retyping the hierarchy.

How are TOML datetimes represented?

As ISO 8601 strings. YAML 1.2 has no required date type, so a string guarantees nothing is lost in the jump; loaders that want a date can parse the ISO string back.

Is my data sent to a server?

No. It's built on smol-toml and js-yaml running in your browser. Your data stays in memory and never reaches a log or third-party API.

Is there a command-line equivalent?

You can get a similar result with yq — e.g. yq -oy eval config.toml. This page is the zero-install version, and it keeps the file on your machine.