CSV to YAML Converter

YAML is what modern config files are made of: Kubernetes manifests, GitHub Actions workflows, Docker Compose, Ansible playbooks, Rails fixtures. This converter reads a CSV and produces a YAML sequence where each row becomes a mapping keyed by the header row. The output uses two-space indentation and a 4-level inline threshold, which matches the style of most editors and linters.

How CSV becomes YAML

  1. 1

    Paste the CSV

    A sample is pre-loaded so you can see the default output shape; replace it with your data.

  2. 2

    Choose the delimiter

    Comma by default. Enter `\t` for tab-separated input or any other single character your file uses.

  3. 3

    Headers become keys

    Row 1 is treated as the header. Data rows become mappings under those keys in the same order as the source columns.

  4. 4

    YAML dumped safely

    The output is rendered by the Symfony YAML component, which quotes values when ambiguity with booleans, numbers or dates would otherwise occur.

YAML quirks you should know before pasting the output

YAML is famously forgiving on the surface and full of traps underneath. The dumper handles most of them, but your data still has to survive round-tripping.

The Norway problem and friends

YAML 1.1 treats a bare no, yes, on, off, true, false, y, n (and their capitalised forms) as booleans. Meaning a country code column with NO for Norway can silently turn into false.

Source cell Emitted as (unquoted) Usually intended as
NO false The country Norway
ON true The state Ontario
123 123 Either number or ID
0100 64 (octal!) A leading-zero code

The dumper quotes risky values automatically, but if you are seeing wrong types in your output, switch to YAML 1.2 parsers downstream or explicitly quote values you care about.

Formatting choices

  • Two-space indentation. Standard for most editors; linters like yamllint default to this.
  • Inline threshold 4. Deeply nested structures print on one line below the 4th level, above it they expand to multiple lines. Adjust downstream if you want stricter blocks.
  • Anchors and aliases are not generated. Each row is a fresh mapping even if rows repeat.

Example output

- name: Alice
  age: 30
- name: Bob
  age: 25

When to pick YAML over JSON

  • Hand-edited configs, where comments and multi-line strings matter.
  • Kubernetes manifests, CI pipelines, Ansible plays.
  • Any context where people will read the file as much as machines will.

Otherwise JSON is stricter and faster to parse, prefer it for wire formats and generated payloads.

Frequently Asked Questions

YAML 1.1 interprets bare NO as a boolean. The converter quotes risky values, but if a downstream parser still coerces types, quote the problematic cells before pasting the output or switch to a YAML 1.2 parser that treats those as plain strings.

Not with this converter, each row becomes a flat mapping. For nested YAML, build a small script around a YAML library, or convert to JSON first and shape that in a JSON editor.

Cells are parsed with str_getcsv using your chosen delimiter. Quoted values preserve embedded delimiters and quotes the same way they would in a real CSV parser.

Yes. The CSV you paste is sent to our server, because parsing and YAML serialisation run there. It is used only to generate the YAML result and is not stored.

Related Tools

Tool available in other languages