PrettifyPrettify

YAML to CSV Converter

Paste a YAML list of mappings and get a CSV table with one row per item and one column per key. Prettify merges the keys of all items, leaves missing values blank, and quotes fields that need it. The conversion runs in your browser.

CSV
The converted result shows here as you paste.
Runs in your browser. Nothing is uploaded.

How a YAML list becomes a table

CSV is flat and YAML is not, so the shape of the YAML decides the result. The best input is a list of mappings that share keys. Each item becomes a row, and the header is the set of keys from all items, in the order Prettify first meets them.

If an item lacks a key that other items have, its cell is blank. A key that appears only in a later item still gets its own column, so no value is dropped.

Key features

The converter writes standard CSV, so spreadsheets and import tools can read it. These details decide what the file looks like and what a spreadsheet makes of it.

  • Rows end with CRLF line breaks, the usual CSV line ending.
  • A field that contains a comma, a quote, or a line break is wrapped in quotes.
  • A YAML null becomes a blank cell.
  • Anchors, aliases, and merge keys are resolved first, so each row shows its full values.
  • YAML comments are not data, so they do not reach the CSV.
  • A list of plain values becomes a single column with no header.
  • A nested mapping becomes columns such as env.region, and a list stays in one cell as JSON text.

How to convert YAML to CSV

Convert in the box on this page, then continue in the editor. The box reads documents up to 512 KB and converts the first document of a file that holds several. If the YAML has an error, the panel shows the line and column.

  1. Paste your YAML into the box labeled "Paste your YAML", or select "Try an example".
  2. Read the CSV in the result panel. A warning appears under the summary when the shape needed a change.
  3. Select Copy to put the CSV on the clipboard, or select Download to save it as prettify.csv.
  4. Select "Open in full editor". The editor opens at /app/editor with the CSV in the Raw view.
  5. Switch to the Table view in the editor to sort and search the rows.
  6. For a larger file, open the YAML in the editor, select Convert in the Transform group of the toolbar, and pick CSV.

Worked example: a service list

The YAML below lists three services. Only the second has a replicas key, and the third has a comma in its name and a null port. The block after it is the CSV that Prettify produces.

The header holds name, port, and replicas. The first service has no replicas, so that cell is blank. The third name contains a comma, so it is wrapped in quotes. Its null port is a blank cell. Each line ends with a CRLF break.

- name: api
  port: 8080
- name: worker
  port: 9000
  replicas: 3
- name: "cache, primary"
  port: null

name,port,replicas
api,8080,
worker,9000,3
"cache, primary",,

Common uses

YAML lists are easy to write and hard to scan. A table lets you sort, filter, and share the same data with people who do not read YAML, and it needs no retyping.

  • Move a YAML inventory of services, users, or hosts into a spreadsheet.
  • Review a long list of settings with sorting and search in the Table view.
  • Give a teammate a sheet instead of a configuration file.
  • Prepare a list for a tool that imports CSV.
  • Run SQL over the result with the SQL panel. SQL is a Pro feature with one free try per day.

Nested values and other limits

A cell holds one flat value. A nested mapping, such as env with region and tier inside, becomes the columns env.region and env.tier. A list inside an item stays in one cell as JSON text, such as ["queue","batch"]. The panel names both changes. Converting the CSV back to YAML keeps env.region as one key.

If the YAML is a single mapping and not a list, Prettify wraps it into a one-row table and warns you. YAML does not keep types in CSV either, so a number and a string look the same in a cell.

Frequently asked questions

Is the YAML to CSV converter free?

Yes. Converting YAML to CSV, then copying or downloading the table, is free and needs no account. SQL queries and multi-column charts over the CSV are the Pro additions.

Is my YAML uploaded to convert it?

No. Parsing and conversion run on your device, so a manifest or an inventory with internal names is not sent to a server. Prettify sends data only when you create a share link.

What if my YAML is one mapping and not a list?

Prettify wraps the mapping in a list, so you get a CSV with one row and a warning. A top-level key that holds a list of mappings becomes one cell of JSON text, so move the list to the top level first.

Which line endings does the CSV use?

The converter writes CRLF line breaks between rows, which is the usual CSV line ending. A field that holds a line break inside quotes keeps its own line feed.

Does the column order follow my YAML?

The columns follow the order in which keys first appear, reading the items from the top. A key that first shows up in a later item is added after the others. Keys that are whole numbers, such as 2024, come first within an item.

Can I convert the CSV back to YAML?

Yes. The CSV to YAML page turns each row back into a mapping keyed by the header. Every value returns as text, so a number such as 8080 comes back as the string '8080'.

Related tools