CSV to YAML Converter

Convert a CSV table into a tidy YAML block sequence — a list of objects, one per row, with the header row mapped to keys. Scalars are typed: bare integers and floats stay unquoted, true/false/null are recognised as YAML literals, and strings are quoted only when they contain YAML-special characters. The result uses two-space indentation and parses identically in any YAML 1.1/1.2 loader, so it drops straight into a config, fixture, or manifest.

How to use the CSV to YAML Converter

Paste CSV with a header row; the first row supplies the keys for every object. The converter emits a YAML block sequence where each row becomes a - key: value item. If your file has no header, tick No header row and keys become col1, col2, and so on. Choose the Delimiter that matches the file (comma, semicolon, or tab).

With Infer numbers / booleans / null on, the tool types each cell: a value matching an integer or float is emitted unquoted so YAML loads it as a number, the words true, false, and null (and an empty cell) become the corresponding YAML literals, and everything else is treated as a string. Strings are quoted only when they would otherwise be ambiguous — if they contain a colon-space, #, leading or trailing whitespace, look like a number or boolean but should stay text, or start with a YAML indicator character. The output uses two-space indentation per the YAML convention. Turn inference off to force every value to a quoted string. Use Download .yaml to save the file.

What is the CSV to YAML Converter?

YAML looks forgiving, but emitting it correctly from arbitrary CSV is mostly about scalar typing and quoting. YAML is typed: port: 5432 loads as an integer, enabled: true as a boolean, and value: null (or an empty value) as null. If you blindly quote everything you get valid but ugly YAML where numbers arrive as strings; if you quote nothing you risk a string like NO, 3.10, or 2024-01-01 being silently coerced to a boolean, a truncated float, or a date by the loader. The right behaviour is to leave genuine numbers and booleans bare and to quote strings precisely when they would be misread.

The cases that require quoting are specific. A value containing a colon followed by a space (: ) would be parsed as a nested mapping; a value with a # after whitespace would be read as a comment; leading or trailing spaces are stripped from unquoted scalars; an empty string is indistinguishable from null unless quoted; and a string that looks like a number, boolean, or null (true, 0755, ~) must be quoted to stay a string. Values beginning with a YAML indicator character — - ? : , [ ] { } # & * ! | > ' " % @ ` — also need quoting. This converter checks each of those conditions and quotes only when one applies, producing minimal, idiomatic YAML.

The output is a block sequence of mappings: a top-level list (each item prefixed with -) where every item is a flat key-value object built from one CSV row. That is the canonical "list of records" shape and is exactly what the reverse YAML to CSV converter consumes, so the two round-trip. Reading the CSV is RFC 4180 compliant: quoted fields may contain the delimiter, embedded quotes (written ""), and newlines, all handled as single values rather than splitting the row.

Common use cases

  • Generating config and fixtures — maintain data in a spreadsheet and emit a YAML list for seeding tests or apps.
  • Kubernetes / CI value files — turn a CSV of settings into a typed YAML list ready to drop into a manifest or pipeline.
  • Migrating from spreadsheets to code — convert a tracked CSV into human-readable YAML for version control and review.
  • API mock data — build a YAML list of sample records from a CSV for stubbing endpoints.
  • Documentation and examples — produce neat, correctly-typed YAML snippets to illustrate a schema or config option.
  • Round-tripping data — export YAML to CSV, edit in a spreadsheet, then convert back to YAML with consistent typing.

Frequently asked questions

When does a value get quoted?

Only when leaving it bare would change its meaning: it contains ": " or a "#" comment marker, has leading/trailing spaces, is empty, looks like a number/boolean/null but should stay a string, or starts with a YAML indicator character. Plain text that is unambiguous is left unquoted.

How are numbers and booleans handled?

With type inference on, integers and floats are emitted unquoted so they load as numbers, and the literals true, false, and null (plus empty cells) become YAML scalars. Turn inference off to force every value to a quoted string.

What output structure does it produce?

A YAML block sequence of mappings — a top-level list where each CSV row becomes a "- key: value" object built from the header. Indentation is two spaces, matching YAML convention.

Does it handle quoted CSV fields with commas?

Yes. The parser is RFC 4180 compliant: a quoted field can contain the delimiter, newlines, and escaped double quotes (""), and is read as one value rather than splitting into extra keys.

Is anything sent to a server?

No. Parsing and YAML generation run entirely in your browser, so your CSV stays on your machine — safe for sensitive data.