// converters

CSV to YAML.

Parse CSV (with quoted fields) and produce a YAML array of mappings using the first row as headers.

Client-sideStrict quotingNo upload

CSV input

YAML output

How CSV-to-YAML conversion works.

CSV is flat and row-based; YAML is nested and hierarchical. This tool parses each CSV row into an object using the header row as keys, then outputs the result as a YAML array of mappings. The first row must contain column headers — these become the YAML keys for each element.

The tool handles quoted fields, escaped delimiters, and multi-line values per RFC 4180. It also auto-detects types: numbers become YAML numbers, true/false become booleans, empty cells become null, and everything else stays as a string.

When to use CSV-to-YAML.

Data migration. When moving data from a spreadsheet (Excel, Google Sheets) to a YAML-based system (Jekyll, Hugo, static site generators), convert the CSV export to YAML for direct use in templates and config files.

Configuration. Some tools store their config in CSV (database connection lists, IP allowlists). Convert to YAML for better readability, comments, and hierarchical organization.

Data normalization. YAML supports nested structures, comments, and anchors that CSV doesn't. Convert CSV data to YAML when you need to add metadata, group related entries, or use YAML anchors to reduce repetition.

Delimiter options.

Comma (,) — the standard CSV delimiter. Used by most tools. Semicolon (;) — common in European locales where comma is the decimal separator. Pipe (|) — used in some data pipelines and when data contains both commas and semicolons.

Choose the delimiter that matches your input. If your CSV file was exported from Excel in a European locale, try semicolon. If you're pasting pipe-delimited data from a log file, use pipe.

CSV parsing and RFC 4180.

RFC 4180 is the official standard for CSV format. It defines how fields containing commas, quotes, or newlines should be escaped: enclose the field in double quotes and double any quotes within the field. This tool follows RFC 4180 strictly, so it correctly handles quoted fields, escaped delimiters, and multi-line values.

Many tools export CSV that does not fully comply with RFC 4180 — they may use single quotes, backslash escapes, or inconsistent quoting. This tool is lenient where possible but strict where it matters, ensuring your YAML output is always valid regardless of the input quirks.

Data migration workflows.

Spreadsheet to static site. Export your spreadsheet as CSV, convert to YAML, and use the output directly in Jekyll, Hugo, or Eleventy data files. YAML's hierarchical structure lets you add metadata, comments, and relationships that the spreadsheet could not represent.

Database to configuration. When migrating database records to a configuration-driven system, export the relevant tables as CSV and convert to YAML. The resulting file can be committed to version control, reviewed in pull requests, and deployed alongside your application code.

API data transformation. Some APIs return CSV responses. Convert the CSV to YAML for easier debugging, documentation, or integration with YAML-based tools like Kubernetes, Ansible, or Terraform.

Type detection and YAML output.

The converter automatically detects data types from CSV values: integers and decimals become YAML numbers, true and false become booleans, empty cells become null, and everything else stays as a string. This means your YAML output has proper types rather than everything being quoted strings.

Quoted values in CSV are unquoted in the YAML output when the content does not require quoting. This produces clean, readable YAML that follows standard formatting conventions. If you need a specific quoting style, format the YAML output with the YAML formatter tool afterward.

FAQ

How do I convert a CSV with headers to a YAML array of objects?

Use `csv2yaml` (Python: `csv.DictReader` → list of dicts → `yaml.safe_dump`), or `miller` (`mlr --c2y`) which does it in one CLI call.

How do I convert CSV to YAML where each row becomes a separate YAML document?

Use `yq -p=csv -o=yaml` or in Python loop `csv.DictReader` and call `yaml.dump_all([...])` for multi-document YAML output.

How do I handle CSV cells with commas inside quotes?

Standard CSV parsers (Python `csv`, `miller`, `csvkit`) handle RFC 4180 quoted fields automatically; just don't use a naive `split(',')` approach.

Can I convert a CSV to YAML without headers (use column index as key)?

Yes — `miller --c2y` with `--no-header-row` or Python: read rows, use `f"col{i}"` for each value, then dump to YAML.

How do I convert CSV with dates/numbers to YAML preserving types?

Use `csv.DictReader` then explicitly parse types (`int(val)` or `datetime.strptime`) before dumping; YAML will auto-type numbers but dates need quoting or custom representers.