YAML to CSV
Paste a YAML list, get a CSV file — every column, every record.
YAML Input
CSV Output
A YAML sequence of mappings is already a table — this just writes it out as one
A lot of YAML people work with is already tabular underneath the indentation: a Kubernetes subjects list, an Ansible inventory, an HSS subscriber export, a CI matrix. Each entry in a sequence is a mapping with roughly the same keys, which is exactly what a CSV row is. This page reads that sequence with js-yaml and writes it out as a proper RFC 4180 CSV file.
The column list is the union of every record's keys, not just the first one's. Real YAML exports drift — a field added to later entries, an optional key only some subscribers have — and taking record zero's keys as the schema is how a converter silently drops a column nobody meant to lose. This page scans every record before deciding the header row.
A number too large for JavaScript to represent exactly — a 19-digit ICCID is the recurring example on this site — is read from the YAML source text as a string of its exact digits, not through js-yaml's normal number handling, which would round it the same way JSON.parse rounds an oversized integer. See the large-number notes on the JSON tools if this is the first time you have hit that class of bug.
Nothing is uploaded. Parsing and CSV writing both happen in your browser.
Converting a list
- Paste the YAML – A top-level sequence of mappings, or a mapping whose value is that sequence (
subscribers: - ...) — both are read the same way. - Watch the CSV build – The right pane fills in as you type, with the row count shown once there is a result.
- Copy or download – Download gives you a real
.csvfile, quoted the same way every other CSV export on this site is.
A lone mapping (no sequence) becomes a one-row CSV — its keys become the header row, its values the single data row. That is useful for a single config record, but if you meant to convert a list and pasted only its first entry by mistake, one row back is usually the tell.
A subscriber roster, YAML to CSV
Three subscribers where the third one carries a field (notes) the first two do not — the column still appears for every row, empty where the source had nothing to say.
subscribers:
- subscriberId: SUB-1001
plan: Unlimited 5G
- subscriberId: SUB-1002
plan: Pay As You Go
- subscriberId: SUB-1003
plan: Business 200GB
notes: VIP account"subscriberId","plan","notes"
"SUB-1001","Unlimited 5G",""
"SUB-1002","Pay As You Go",""
"SUB-1003","Business 200GB","VIP account"When you need this
Opening a Kubernetes or Ansible list in a spreadsheet
A values.yaml list of ingress rules, a RoleBinding's subjects, an inventory's hosts — reviewing them as rows and columns in a spreadsheet is often faster than reading nested YAML, especially for spotting which entries are missing a field.
Handing a YAML export to someone who wants Excel
Not everyone reviewing subscriber data or a config export wants to read YAML. Converting to CSV first means the file opens directly, with no explanation needed about indentation or block scalars.
Diffing two YAML snapshots as a spreadsheet
Two exports taken a week apart are easier to compare row-by-row in a spreadsheet's own diff or sort tools than by reading two YAML files side by side.
Feeding a YAML list into a tool that only reads CSV
Plenty of bulk-import tools, mail-merge features, and BI dashboards accept CSV and nothing else. This is the fastest path from a YAML source to that shape.
What this page does
- Reads a top-level sequence of mappings, or a mapping wrapping one, and writes it as CSV.
- Columns are the union of every record's keys, so a field only some entries have still gets its own column rather than disappearing.
- A 19-digit ICCID or other oversized integer keeps its exact digits rather than being rounded.
- Quotes the same way every other CSV export on this site does, via the shared CSV writer.
- Runs entirely in your browser — nothing is uploaded.
Questions people actually ask
What if my YAML is not a list at top level?
A single mapping (subscriber:
msisdn: ...) is treated as one record and becomes a one-row CSV with its keys as the header. A mapping whose value IS a sequence (subscribers:
- ...) has that sequence tabulated. A bare scalar or a list of scalars has nothing to make columns from and reports that instead of guessing.
What happens to a nested object inside a record?
It is written into its cell as its own compact representation rather than being flattened into separate columns — the same behaviour JSON to CSV uses, so the two pages are consistent with each other.
Why does a column appear empty for some rows?
Because that record's mapping never had that key. The column still exists — it is the union of every record's keys — so a field only your third entry carries shows up as an empty cell everywhere else rather than shifting the columns after it out of alignment.
Does this handle a YAML anchor or alias?
Yes — js-yaml expands anchors and aliases during parsing, so a record built from a <<: *defaults merge key looks in the CSV exactly like one that spelled out every field itself.
Related tools
Specifications and references
- RFC 4180 – The closest thing CSV has to a formal specification
- js-yaml – The parser behind this page and every other YAML tool on this site
- YAML 1.2.2 Specification – Covers sequences, mappings, anchors and merge keys
- Kubernetes kubeconfig – One real-world YAML list this page is built to read