Open or paste a CSV file and each row becomes one item in a YAML list, keyed by the header. By default every value stays text, and values a YAML parser would otherwise reinterpret — NO, yes, 0150, 2024-03-01, null — are quoted so they load back exactly as written. The file is converted in your browser and never uploaded.
How to convert CSV to YAML
- Select Open file, drop a
.csv,.tsvor.txtfile on the tool, or choose Paste. Check the delimiter and encoding under Import settings if the keys look wrong. - Choose Value types and how Empty cells are written. The YAML tab shows the exact text the download will contain.
- Pick the Indentation, then select Copy or Download YAML.
The result is a top-level sequence (- key: value items), the shape used for fixtures, seed data and static-site data files. If you need JSON instead, CSV to JSON has the same type options.
YAML output options
| Keep every value as text | The default. Every value is a YAML string; quotes are added only where a plain scalar would be read as something else. |
|---|---|
| Detect numbers and true/false | A column becomes YAML numbers only if every non-empty value is a plain number without leading zeros and with at most 15 significant digits; true/false columns (any case) become booleans. yes/no and dates stay quoted strings. Numbers are written in canonical form, so 1.50 becomes 1.5. |
| Empty cells | null (the default) writes key: null; Empty text "" writes key: ""; Leave the key out drops that key from the row. |
| Indentation | 2 spaces (default) or 4 spaces for keys under each list item. |
How ambiguous values are quoted
The output is written to read back the same in YAML 1.2 parsers and in older YAML 1.1 parsers such as PyYAML, which treat more words as booleans and numbers.
- Country and answer codes:
NO,yes,off,yandonare quoted, so Norway’s code is not loaded asfalse. This applies to keys too ("on": x). - Leading zeros:
0150and08001are quoted; unquoted, YAML 1.1 reads them as octal or decimal numbers and drops the zero. - Dates and numbers in text mode:
2019-04-01and12are quoted so they are not loaded as a timestamp or an integer. - Null-like text: a cell containing
nullor~is quoted, so it stays the text you wrote and is not confused with an empty cell. - Line breaks inside a value become a
|-literal block, and:or#inside text is quoted. Long lines are never folded. - Headers are used as keys exactly as written, including spaces and non-Latin scripts. A blank header becomes
Column 3and a repeated onename (2).
Common CSV to YAML problems
- A number column stayed quoted with Detect numbers and true/false. At least one value is not a plain number, for example
1,5,12 kgor007. Find it in the CSV viewer. - A yes/no column did not become booleans. Only
trueandfalseare converted, becauseyes,noandonmean booleans only in YAML 1.1. Replace them first with the text tools in the CSV editor if you need booleans. - Keys contain odd characters such as é. The file is not UTF-8. Choose its encoding under Import settings.
- Everything is under one key. The delimiter was guessed wrong; set it under Import settings.
Limits and privacy
Files up to 25 MB, 100,000 rows or 2 million cells open with a live preview of the first 200 rows. Larger files are converted in streaming mode: the file is read twice in chunks (once to measure the columns and their types, once to write), a notice says the download covers the whole file, and Copy is not offered. A single output file is capped at 4 GB.
The conversion runs in a background worker in this tab, so the page stays responsive and Cancel stops it. The CSV is never sent to a server.
Example: a customer list with country codes and postcodes
A customer list with country codes, postcodes with leading zeros, yes/no flags, dates and empty cells, converted with the default settings (all text, empty cells as null). With Detect numbers and true/false, only orders changes, to 12, 3 and 7.
country,code,postcode,vat_registered,since,orders Norway,NO,0150,yes,2019-04-01,12 Spain,ES,08001,no,2021-11-15,3 United States,US,02134,,,7
- country: Norway code: "NO" postcode: "0150" vat_registered: "yes" since: "2019-04-01" orders: "12" - country: Spain code: ES postcode: "08001" vat_registered: "no" since: "2021-11-15" orders: "3" - country: United States code: US postcode: "02134" vat_registered: null since: null orders: "7"
Questions and answers
Why is `NO` in quotes?
In YAML 1.1, unquoted NO, no, off and n mean false. Quoting keeps a Norwegian country code, or any answer written as no, as text in every parser.
Can I get one mapping keyed by an ID instead of a list?
No. Each CSV row is written as one list item, in file order. Keyed output is not available here.
Is the output valid YAML 1.2?
Yes. The extra quoting needed for YAML 1.1 is still valid YAML 1.2; it only makes values that were already strings explicit.