YAML to CSV Converter

Paste a YAML sequence of mappings and get back a proper CSV table with a header row, ready to open in a spreadsheet or import elsewhere. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

A YAML list of records, the kind you'd get from a fixture file or an exported dataset, is awkward to review at a glance because each record is spread across several indented lines. This converter turns that list into a proper CSV table, one row per record, ready to open in a spreadsheet.

It's most useful for tabular data specifically: records that share a mostly-consistent set of fields. Deeply nested or highly irregular YAML still converts, but the resulting table gets wider and less readable the more it deviates from a flat, list-of-records shape.

What Is YAML to CSV Converter?

A YAML-to-CSV converter parses a YAML sequence of mappings and produces a CSV file: a header row of column names followed by one row per record.

It reuses the same flattening and escaping logic as this site's JSON to CSV Converter, so nested keys become dotted column names and any cell containing the delimiter, a quote, or a newline is quoted per RFC 4180.

How YAML to CSV Converter Works

The input is parsed as YAML, then the resulting value (an array of objects, or a single object treated as one row) is serialized as CSV: the union of every record's keys becomes the header, and each record fills a row, with empty cells for keys it doesn't have.

Nested objects are flattened with dot notation, and nested arrays are serialized as a single JSON string per cell.

When To Use YAML to CSV Converter

Use it when you have a YAML fixture or exported list and need a table to open in a spreadsheet or import into a tool that only accepts CSV.

It's also useful for a quick visual sanity check on a list of records, since a table is often easier to scan for outliers than nested YAML.

Features

Advantages

  • Runs entirely client-side.
  • Produces RFC 4180-compliant CSV, cells are quoted only when needed.
  • Handles records with inconsistent keys by unioning all columns.
  • Selectable delimiter for different locale or spreadsheet conventions.

Limitations

  • Nested lists inside a record are flattened into a single JSON-string cell, not split into multiple columns or rows.
  • CSV has no types, every value becomes text; numbers, booleans, and strings all look identical in the output.
  • A YAML document that isn't list-of-records shaped can still convert, but the result may be a very wide or sparse table.

Examples

List of records

Input

- id: 1
  name: Ada
  role: admin
- id: 2
  name: Grace
  role: editor

Output

id,name,role
1,Ada,admin
2,Grace,editor

Each mapping in the sequence becomes one CSV row, with its keys forming the header.

Nested object flattens into dotted columns

Input

- id: 1
  address:
    city: Boston

Output

id,address.city
1,Boston

The nested address.city value becomes its own column rather than being dropped.

Best Practices & Notes

Best Practices

  • Keep source records reasonably flat and consistent for the most readable CSV output.
  • Check for a JSON-string-looking cell if a field contains a nested list, that's the flattening behavior, not an error.
  • Choose semicolon delimiting if the CSV is headed for a locale where commas are used as decimal separators.

Developer Notes

This parses YAML with the `yaml` package and pipes `JSON.stringify()` of the result into the existing `jsonToCsv()` function from the JSON category, so YAML and JSON inputs describing the same records always produce identical CSV. No separate CSV-writing logic is maintained for this tool.

YAML to CSV Converter Use Cases

  • Exporting a YAML fixture file as a spreadsheet-friendly table
  • Reviewing a list of config entries in tabular form before editing
  • Preparing YAML-sourced data for import into a tool that only accepts CSV

Common Mistakes

  • Expecting nested arrays to split across multiple columns, when they're serialized into a single cell instead.
  • Converting a deeply nested, non-list-shaped document and being surprised by an unreadable, very wide table.

Tips

  • If a column looks unexpectedly wide or JSON-like, that field was a nested list in the source YAML.
  • Pair this with the CSV to YAML Converter to round-trip and confirm a conversion before relying on it.

References

Frequently Asked Questions