YAML to CSV

Convert YAML to a CSV table — a sequence of mappings becomes a headed table whose header is the union of every key, nested values written as compact JSON in their cell, RFC 4180 quoting throughout, and multi-document streams refused rather than half-converted. Your input is never auto-saved: YAML is configuration, and configuration carries secrets. Free, no sign-up — runs locally in your browser.

Nothing here is auto-saved. YAML documents are usually configuration, and configuration files carry secrets — API keys, tokens, internal hostnames. This tool keeps no draft of your input, in your browser or anywhere else: paste, convert, done. Refresh the page and it is gone — that is deliberate.

…or drop a .yaml / .yml file anywhere on this panel (it is read locally, never uploaded).

Why convert YAML to CSV?

Because the person who needs the data next is often holding a spreadsheet, not a parser. Inventories exported from Ansible, front-matter collections, seed data, evaluation sets — the YAML is structured for machines, and the review, the count, the pivot table happen in Excel or Sheets. This converter takes the one YAML shape that dominates those files — a sequence of mappings — and lays it out as a table with the discipline a hand export usually skips: the header is the union of every key in the file (not just the first row's), missing keys leave empty cells instead of shifting columns, and quoting follows RFC 4180, so a comma inside a value never becomes a new column.

How to use this tool

  1. Paste the YAML, upload a file, or drop one on the panel. One document only — multi-document files are refused with an explanation.
  2. Pick the delimiter your spreadsheet expects: comma for most, semicolon for locales where comma is the decimal separator, tab for TSV consumers.
  3. Press Convert to CSV. The status line reports the row and column counts — check them against what you expected.
  4. Read the notes if any appear: stringified keys and other parse-stage facts are listed there.
  5. Copy or download, and remember the input was never saved — if you clear the box, the YAML is gone from this tool entirely.

The mapping rules

Sequences of mappings become headed tables: header is the union of keys in first-seen order, one row per item, a missing key an empty cell. A single mapping becomes a one-row table. Sequences of sequences are written without a header. Nested values (a mapping or sequence inside a row) are written as compact JSON in their cell — the same rule as this site's JSON to CSV converter, because both share one CSV writer. Scalars are spelled naturally: numbers bare, true/false as words, null as an empty cell. Quoting is RFC 4180 throughout: any cell containing the delimiter, a quote or a newline is quoted, with inner quotes doubled.

Worked example

Given this inventory (the second item has no stock):

- sku: A-101
  name: Desk lamp
  stock: 14
- sku: A-102
  name: Chair, oak

the converter emits:

sku,name,stock
A-101,Desk lamp,14
A-102,"Chair, oak",

Three rules visible in three lines: the header includes stock because the first row has it; the missing stock is an empty trailing cell, not a shifted row; and the comma inside “Chair, oak” is why that name is quoted.

Frequently asked questions

What YAML shapes can become a table?

Three. A sequence of mappings becomes a table whose header is the union of all keys in first-seen order — a key missing from a row leaves that cell empty, never shifts the row. A single mapping becomes a one-row table under the same rule. A sequence of sequences is written as rows with no header, since there are no keys to head it with. Anything else — a scalar, a sequence of scalars, a mix of mappings and scalars — cannot form a table, and the converter says so instead of inventing columns.

What happens to nested mappings and sequences inside a row?

They are written into their cell as compact JSON — {"x":1} — quoted by the normal CSV rules. A table cell has to be text; the choices are JSON, a flattened path-per-column scheme, or dropping the value. JSON is the only one that loses nothing and can be read back mechanically, so that is the rule here — the same rule the JSON to CSV converter on this site applies, because both tools share the same CSV writer.

Are values typed, or does everything stay a string?

CSV has no types — every cell is text — so the question is really about spelling. Values are written in their natural form: numbers without decoration (36, not "36"), booleans as true/false, strings as themselves, and a YAML null as an empty cell. What the converter will not do is reformat numbers: 1.50 in the YAML is the number 1.5 after parsing, and 1.5 is what the cell holds. If the trailing zero carries meaning (money, versions), quote the value in the YAML so it stays a string end to end.

My YAML has several documents separated by ---. What happens?

The converter refuses, and says how many documents it found. Each document would be its own table, and quietly converting the first (or stacking them) would produce a CSV that misdescribes your file. Split the documents and convert each one — which table a stream means is a decision, so the tool leaves it to you.

I use anchors and aliases. Do they survive?

They are resolved before conversion: an aliased mapping appears in the table as the full row it points at, and a merge key contributes its keys to the row like any others. The table describes the values, not the anchor syntax — which is the point of a CSV export. The sharing itself is lost (two rows that were one anchor become two identical rows), and rows in a spreadsheet are values anyway, so nothing the format could keep has been dropped.

Why isn't my input auto-saved like on other tools?

Because YAML is usually configuration, and configuration files carry secrets — API keys, tokens, internal hostnames, database passwords. This converter keeps no draft of your input, in your browser or anywhere else: paste, convert, done. Refresh the page and it is gone — that is deliberate, and it is the same rule on every YAML tool on this site. The CSV output is shown on screen only; downloading it is your explicit act.

Related tools