Convert CSV to YAML
Convert CSV to YAML with smart type detection, multi-line block scalars, reserved-word quoting (no false-boolean traps). Free, offline, client-side, instant.
Convert CSV/TSV to YAML with 3 type-coercion modes (preserves "007" ZIP codes), multi-line block scalars (| for embedded newlines), and YAML reserved-word quoting - cells like "yes", "no", "null" are auto-quoted so they don't accidentally become booleans/null on the way back through a YAML parser.
How to Use Convert CSV to YAML
- Paste CSV into the input pane, upload a
.csv/.tsvfile, or click Load sample. - Pick a delimiter (auto-detect handles comma/semicolon/tab/pipe).
- Toggle First row is headers. Headerless mode emits
field1,field2, … - Pick a type-coercion mode: All strings (safest, preserves "007"), Smart with safe IDs (default - leading-zero strings and UUIDs stay strings), Auto-detect (full conversion, may lose "007" ZIP codes - warning shown).
- Pick an output style: block (multi-line, human-readable) or flow (single-line JSON-like array).
- YAML reserved words (
true,false,yes,no,on,off,null,~- all case-insensitive) are auto-quoted to preserve string identity. A cell containing"yes"in your CSV stays the string"yes"in YAML, not the booleantrue. - Cells with embedded newlines automatically use the
|block literal scalar - preserving line breaks readably. - Copy or download
data.yaml.
Frequently Asked Questions
What’s the “Norway Problem”?
YAML 1.1 treats NO (the ISO country code for Norway) as the boolean false. So a CSV column listing country codes including NO becomes a list with false in it after YAML parse – Norway disappears. Same for ON (Ontario), OK (Oklahoma, though that’s not a YAML keyword). YAML 1.2 fixed this for new parsers, but Ruby, Go, Python’s PyYAML default mode still use 1.1 semantics. The tool always quotes these to be safe.
When should I use block vs flow style?
Block (default): - name: Janen age: 30 – human-readable, easy to diff, the YAML idiom. Flow: [{name: Jane, age: 30}] – compact, similar to JSON, faster to grep. Use block for config files; use flow for JSON-like data interchange or when YAML is one line in a larger file.
How does multi-line scalar work?
If a CSV cell contains a newline (typical for description / note fields with line breaks), the tool emits it as a | block literal: note: |n first linen second line. The pipe | tells YAML “this is a literal string, preserve newlines as-is”. Alternative: > (folded scalar) collapses newlines to spaces but the tool uses literal because that matches what you put in.
Does YAML support comments?
Yes – lines starting with # are comments. This tool doesn’t currently emit comments (CSV doesn’t have any to convert), but the YAML it produces accepts comments. Add them manually after conversion if needed for documentation.
Why are some values quoted and others aren’t?
YAML quoting rules: required for strings containing :, #, brackets, newlines (unless using block literal), or strings that LOOK like other types (numbers, booleans, null, reserved words). Strings like Jane or simple text don’t need quotes. Strings like "yes" or "007" or "contains: a colon" do. The tool quotes only when needed.
Does it handle UUIDs correctly?
Yes. UUIDs (550e8400-e29b-41d4-a716-446655440000) contain hyphens and look numeric-ish to naive parsers. In “Safe IDs” mode, the tool detects the letter-and-hyphen pattern and treats them as strings – preserving the format.
What’s the YAML 1.1 vs 1.2 problem?
YAML 1.1 (still default in many parsers): treats yes/no/on/off as booleans, octal numbers via 0 prefix, sexagesimal numbers via :. YAML 1.2 (newer spec): only true/false for booleans, only 0o prefix for octal. This tool quotes proactively so output works in BOTH versions safely.
Can I use this YAML in Docker Compose, Kubernetes, GitHub Actions?
Yes. Block-style output is the standard for: docker-compose.yml, Kubernetes manifests, GitHub Actions workflows (.github/workflows/*.yml), GitLab CI, Ansible playbooks. Each of those uses YAML 1.1 semantics (mostly), so the tool’s quoting helps avoid surprise behavior.
Is my data secure?
Yes. CSV input + uploaded files + generated YAML all stay in your browser. Nothing is uploaded.