CSV to YAML Converter
Convert CSV data to YAML format
Tip: The first row will be used as keys in the YAML output. Each row becomes an array item.
Runs in your browserInput CSV
Convert CSV to YAML in your browser
Paste CSV, open a .csv file or drop it on the input window, and the YAML appears as you type. Each row becomes one item of a YAML list, starting with -, and the column names from the first row are the keys of that item. Copy the result or download it as a .yaml file.
Quoted CSV fields are read by the rules of RFC 4180, so a value like "Portland, OR" stays one value. The YAML itself is written by js-yaml, with two-space indentation and no line wrapping.
CSV to YAML example
Real output for a two-row export. Note which values end up in quotes:
id,name,city,zip,active
1,Mara Quill,"Portland, OR",97201,true
2,Theo Brandt,Boston,02134,false
- id: 1
name: Mara Quill
city: Portland, OR
zip: 97201
active: 'true'
- id: 2
name: Theo Brandt
city: Boston
zip: '02134'
active: 'false'
Why some YAML values are quoted
YAML reads an unquoted value as a number, a boolean or null when it looks like one. A cell that must stay text gets single quotes:
-
CSV
97201,42YAMLStay plain: the cell is a whole number, so the YAML holds a number.
-
CSV
02134,4.50YAMLBecome
'02134'and'4.50'. Without quotes YAML would read a number and drop the zero. -
CSV
true,null,yesYAMLBecome
'true','null'and'yes', because the CSV cell is text. Remove the quotes in the YAML if you want a real boolean or null. -
CSV
,,YAMLAn empty cell is written as
'', an empty string, and a short row gets''for its missing columns.
Rows, keys and long text
Handled
- Text with commas stays unquoted when YAML can read it back, such as
Portland, OR - A quoted cell with line breaks becomes a
|-block, one line of text per line - Header names are trimmed, an empty one becomes
column_Nand a repeated one gets its position added
Not done
- Nest keys from names like
address.city: it stays one key - Write a map keyed by one column: the output is always a list of rows
- Keep cells beyond the last header column: they are left out
Need the CSV back?
The YAML to CSV converter turns a list of items back into rows, with nested keys as dot-path columns.
CSV to YAML questions
Click Open file and pick the .csv, or drop the file on the input window. It is read in your browser and converted straight away; Download saves the result as a .yaml file.
A CSV cell is always text, and an unquoted true would turn it into a boolean. The quotes keep the value you had; delete them where your config expects a boolean.
No. Each value stays on one line however long it is. Only a cell that already contains line breaks is written as a multi-line block.
Yes, with the CSV to JSON converter. It reads the CSV with the same rules and writes an array of objects.
No. Converting runs in your browser, and an opened file is read there too.