YAML to CSV
Convert YAML arrays of objects to CSV spreadsheet format with auto-detected column headers.
YAML to CSV conversion
This converter handles YAML arrays of objects (the most common case for tabular data) by auto-detecting column headers from the union of all keys across all items. Missing values become empty cells. It also handles plain YAML objects by producing a two-column key/value CSV. Values with commas, quotes, or newlines are automatically escaped per RFC 4180. All processing runs entirely in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Turning a YAML list of records into a spreadsheet for someone who does not read YAML.
- Producing a tabular view of a manifest's repeated entries.
- Extracting a flat table from configuration for an audit.
- Converting a YAML dataset for a tool that only accepts CSV.
- Comparing a YAML list against a CSV export in one format.
Frequently Asked Questions
- What shape does the YAML need to be?
- A list of mappings — each list item becomes a row and each key becomes a column. That is the only structure with a natural CSV equivalent; a single nested object has no rows, and a list of plain scalars has no columns.
- What happens to nested values?
- They are serialised into the cell rather than expanded into more columns, because CSV is strictly two-dimensional. If nesting matters, flatten it first with dotted keys so each leaf gets its own column.
- Do all rows need the same keys?
- No — the column set is the union of every row's keys, and rows missing a key get an empty cell. That means one unusual record can add a column that is empty for everything else, which is often the first sign of inconsistent data.
- How are commas and quotes escaped?
- Per RFC 4180: a value containing a comma, a quote or a newline is wrapped in double quotes, and internal quotes are doubled. A YAML block scalar with real newlines survives as a quoted multi-line CSV field — valid, though many parsers handle it badly.
- Will the types survive?
- CSV has no types, so everything arrives as text. Beware YAML's implicit typing on the way in: an unquoted `NO` is already boolean false before conversion starts, and `1.20` has become 1.2. Quote in the YAML if the exact string matters.
- What happens when records have different keys?
- The column set is the union of every record's keys, and missing values become empty cells. That is why a heterogeneous YAML list produces a sparse table — CSV has no way to express an absent field differently from an empty one.
Common errors and gotchas
- Feeding in a YAML document that is not a list of flat objects, which has no tabular equivalent.
- Losing nested values, since CSV is two-dimensional and nesting must be flattened or dropped.
- Assuming every record has the same keys, where a missing key leaves an ambiguous empty cell.
- Letting a spreadsheet reinterpret the output, turning version strings into dates and ids into scientific notation.
- Losing comments, which YAML carries and CSV cannot.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.