SmartQueryTools

Convert YAML to CSV Online

Convert YAML files to CSV format directly in your browser. No upload required — your data never leaves your device.

About converting YAML to CSV

YAML to CSV makes sense when a YAML file is really a table: a list of records that all share roughly the same keys. Test fixtures, seed data, inventory lists, Jekyll and Hugo data files and exported config catalogues often look like this. Turning them into CSV lets you sort and filter in a spreadsheet, or load them into a database with COPY.

The file must be a list at the top level, with one mapping per record, each starting with a dash. If the list sits under a key, such as items: at the top of the file, the whole file becomes a single row. Remove the wrapper key and outdent the list first. Records do not need identical keys. Every key seen becomes a column, and records without it get an empty field.

CSV is flat, so nested data is the main problem. A list value such as tags: [red, blue] is written as JSON text, ["red","blue"], inside one quoted field. A nested mapping is not split into columns either; it is kept as JSON text too. Run the Flatten YAML tool first so a city key under address becomes its own address_city column. Unquoted dates such as 2026-03-02 are read as timestamps by the YAML parser and written as 2026-03-02T00:00:00.000Z. Quote them in the YAML to keep plain dates.

Worked example

A small orders export with an ID, a customer name, a date, an amount (one missing) and a true/false flag, converted with the default settings.

Input (YAML)

- order_id: 1001
  customer: Acme Ltd
  order_date: '2026-03-02'
  amount: 249.5
  shipped: true
- order_id: 1002
  customer: Brightside Co
  order_date: '2026-03-02'
  amount: 1200
  shipped: false
- order_id: 1003
  customer: Acme Ltd
  order_date: '2026-03-05'
  amount: 89.99
  shipped: true
- order_id: 1004
  customer: Northwind
  order_date: '2026-03-07'
  amount: null
  shipped: false

Output (CSV)

order_id,customer,order_date,amount,shipped
1001,Acme Ltd,2026-03-02,249.5,true
1002,Brightside Co,2026-03-02,1200,false
1003,Acme Ltd,2026-03-05,89.99,true
1004,Northwind,2026-03-07,,false

What changes when you convert YAML to CSV

  • Each item in the top-level list becomes one CSV row, and the keys become the header line.
  • Column order follows the order in which keys first appear in the file.
  • null, ~ and missing keys all become empty fields, like the amount for order 1004.
  • The quoted date '2026-03-02' stays 2026-03-02. An unquoted date would become 2026-03-02T00:00:00.000Z.
  • Values containing commas, quotes or line breaks, including YAML block scalars, are wrapped in double quotes.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Frequently Asked Questions

Why did my whole YAML file turn into one CSV row?

The top level of the file is a mapping, not a list. A file like "orders:" followed by an indented list is one record with one field. Delete the orders: line and outdent the list so each record starts with a dash at column zero.

How do I get nested YAML keys as separate CSV columns?

Run the Flatten YAML tool first. It turns each nested mapping into separate columns, such as address_city, one level at a time. Run it again for deeper nesting, then convert the result to CSV.

Why did my ZIP code 01234 become 1234?

An unquoted 01234 is an integer in YAML, so the leading zero is gone before conversion starts. Write it as '01234' in the YAML source to keep it as text.

What is CSV format?

CSV (Comma-Separated Values) is a plain-text tabular format supported by virtually every data tool, spreadsheet app, and programming language.

Related Tools