How to use the csv to yaml converter
- Paste your CSV data into the input area.
- Choose whether the first row is a header row.
- Select the delimiter: comma, semicolon, tab, pipe, or a custom character.
- Set the indentation level for the YAML output.
- Copy the generated YAML from the output box.
How the conversion works
The tool parses the CSV text character by character following RFC 4180. It tracks whether it is inside a quoted field: a double quote starts or ends a quoted region, and two consecutive double quotes ("") represent a literal quote inside the field. Delimiters and newlines inside quoted fields are treated as data, not separators. Line endings can be CRLF, LF or CR, and blank lines are skipped. A quote only opens a quoted field at the start of a field, so a stray quote in the middle of a plain value stays a literal character.
After parsing, the result is a two-dimensional array of strings. If First row is header is checked, the first row becomes the keys for a sequence of mappings; otherwise each row becomes a sequence of sequences. The YAML emitter writes two-space (or your chosen) indentation, quotes strings that contain YAML special characters or look like numbers/booleans, and writes null for missing cells in ragged rows.
Supported CSV features
The parser handles the full RFC 4180 feature set:
| Feature | Example | Result |
|---|---|---|
| Quoted field | "hello" | hello |
| Embedded delimiter | "a,b" | a,b |
| Embedded newline | "line1
line2" | line1 line2 |
| Doubled quotes | "He said ""Hi""" | He said "Hi" |
| Empty field | a,,b | empty string |
| CRLF line endings | a,b
c,d | two rows |
Custom delimiters must be a single character. The parser does not support escape sequences like \n inside unquoted fields; use quoted fields for literal newlines.
YAML output structure
With header: each data row becomes a mapping. The output is a YAML sequence of mappings.
- name: Alice
age: "30"
city: New York
- name: Bob
age: "25"
city: Los Angeles
Without header: each row becomes a sequence. The output is a sequence of sequences.
-
- Alice
- "30"
- New York
-
- Bob
- "25"
- Los Angeles
Every CSV value is a string, so anything YAML would read as another type is quoted to stay a string: numbers, true/false, yes/no/on/off, null, dates such as 2024-01-02, and values starting with characters like ! or -. Missing cells in ragged rows are written as a real YAML null. Header names are used as keys and quoted the same way when they need it.
Common issues and edge cases
- Ragged rows: rows with fewer cells than the header get
nullfor the missing keys. Rows with more cells than the header lose the extra cells, and a note under the result tells you how many rows were affected. - Empty input: shows an error instead of output.
- Only a header row: produces an empty sequence
[]. - Duplicate header names: YAML mapping keys must be unique, so repeats get a numeric suffix (
name,name_2) and a note says so. - Trailing newline: a final blank line does not create an extra empty row.
- Large files: the parser runs in the browser main thread. The tool stops at about 3 MB of input or 2 million cells and says so, so the page stays responsive.
When to use CSV vs YAML
CSV is compact, widely supported by spreadsheets and databases, and ideal for tabular data with a fixed schema. YAML is human-readable, supports nested structures, and is common in configuration files (Kubernetes, Ansible, CI pipelines). Use this csv to yaml converter when you need to feed spreadsheet data into a YAML-based system, or when you want to version-control tabular data in a diff-friendly format.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple CSV with header | CSV input: name,age,city / Alice,30,New York / Bob,25,Los Angeles; First row is header: yes; Delimiter: comma; Indentation (spaces): 2 | - / name: Alice / age: "30" / city: New York / - / name: Bob / age: "25" / city: Los Angeles |
| Quoted fields with embedded commas | CSV input: product,price,notes / "Widget, Large",19.99,"Includes tax, shipping" / Gadget,9.99,"No extra fees"; First row is header: yes; Delimiter: comma; Indentation (spaces): 2 | - / product: "Widget, Large" / price: "19.99" / notes: "Includes tax, shipping" / - / product: Gadget / price: "9.99" / notes: No extra fees |
| CSV without header row | CSV input: Alice,30,New York / Bob,25,Los Angeles; First row is header: no; Delimiter: comma; Indentation (spaces): 2 | - / - Alice / - "30" / - New York / - / - Bob / - "25" / - Los Angeles |
| Semicolon delimiter (European format) | CSV input: name;age;city / Alice;30;New York / Bob;25;Los Angeles; First row is header: yes; Delimiter: semicolon; Indentation (spaces): 2 | - / name: Alice / age: "30" / city: New York / - / name: Bob / age: "25" / city: Los Angeles |
| Embedded newlines in quoted field | CSV input: id,description / 1,"First line / Second line" / 2,Single line; First row is header: yes; Delimiter: comma; Indentation (spaces): 2 | - / id: "1" / description: "First line\nSecond line" / - / id: "2" / description: Single line |
FAQ
Does it handle quoted fields with commas inside?
Yes. A field wrapped in double quotes can contain commas, newlines, and doubled quotes. The parser follows the RFC 4180 quoting rules.
What about embedded newlines in a field?
Quoted fields may span multiple lines. The parser treats the newline as part of the field value and does not end the record until an unquoted newline is found.
How are ragged rows handled?
If a row has fewer columns than the header, the missing keys are written with value null. Extra columns beyond the header are left out, and a note under the result reports how many rows lost cells.
Can I use a custom delimiter like a colon?
Select Custom in the delimiter dropdown and type a single character in the custom delimiter box.
Is the output valid YAML 1.2?
The output only uses plain, single-quoted and double-quoted scalars, which are valid in both YAML 1.1 and 1.2. Strings that resemble numbers, booleans, dates or null are quoted so every CSV value stays a string when the YAML is loaded.
Does this csv to yaml converter work with large files?
It works for typical config-size CSVs (thousands of rows). It stops at about 3 MB of input or 2 million cells with a clear message, because everything runs in your browser with no server upload.
Is my data uploaded anywhere?
No. All parsing and conversion happen in your browser. Nothing is sent to a server.