Browser-native file tools

Convert CSV to YAML

Drop a CSV below — get clean, properly-typed YAML you can paste straight into a Kubernetes manifest, an Ansible playbook, or a config file.

Auto-types: integers, floats, booleans (true/yes), null for empty cells. Strings quoted only when needed.
— or paste CSV below

How to convert CSV to YAML

Drop your CSV into the converter at the top of this page (or paste it). Pick an output mode — list of objects for sequences, keyed map for lookup-by-name configs — and the YAML appears instantly. Copy it, or download as .yaml or .yml. Runs entirely in your browser using PapaParse and an in-house YAML serializer — no upload.

  1. Upload your CSV or paste the contents.
  2. Pick the output mode:
    • List of objects — each row becomes a - key: value block in a YAML sequence.
    • Keyed map — one column becomes the top-level key. Use this for Kubernetes ConfigMaps, Helm values.yaml, Ansible host_vars, or any config you look up by name.
  3. Review the auto-typing. Integers, floats, and booleans (true/false/yes/no) are emitted unquoted; empty cells become null; strings are quoted only when YAML requires it.
  4. Download as .yaml (default) or .yml, or copy to clipboard.

Going the other direction? See /yaml-to-csv/.

CSV to YAML examples

Three real-world examples — input on the left, output on the right.

Example 1: Kubernetes deployment list (list of objects)

Input CSV:

name,image,replicas,enabled
api,registry.example.com/api:1.4.2,3,true
worker,registry.example.com/worker:0.9.1,2,true
cron,registry.example.com/cron:1.0.0,1,false

Output YAML (list of objects):

- name: api
  image: registry.example.com/api:1.4.2
  replicas: 3
  enabled: true
- name: worker
  image: registry.example.com/worker:0.9.1
  replicas: 2
  enabled: true
- name: cron
  image: registry.example.com/cron:1.0.0
  replicas: 1
  enabled: false

Drop this straight into a Helm values.yaml under a services: key, or iterate it from a template.

Example 2: Ansible host vars (keyed map)

Same kind of input — but you want to look up by hostname:

host,ip,role,disk_gb
web-01,10.0.1.10,frontend,80
web-02,10.0.1.11,frontend,80
db-01,10.0.2.10,database,500

Output YAML (keyed map, key column = host):

web-01:
  ip: 10.0.1.10
  role: frontend
  disk_gb: 80
web-02:
  ip: 10.0.1.11
  role: frontend
  disk_gb: 80
db-01:
  ip: 10.0.2.10
  role: database
  disk_gb: 500

This is the exact shape Ansible expects in host_vars/ files when collapsed into a single inventory dict.

Example 3: GitHub Actions matrix (list of objects)

Input:

os,node,experimental
ubuntu-latest,18,false
ubuntu-latest,20,false
macos-latest,20,false
windows-latest,20,true

Output:

- os: ubuntu-latest
  node: 18
  experimental: false
- os: ubuntu-latest
  node: 20
  experimental: false
- os: macos-latest
  node: 20
  experimental: false
- os: windows-latest
  node: 20
  experimental: true

Paste under strategy.matrix.include: in your workflow YAML.

Auto-typing: numbers, booleans, nulls

YAML is whitespace-sensitive and type-sensitive. The converter follows YAML 1.2 rules so values come out with the right types:

CSV cellYAML outputParsed as
4242integer
3.143.14float
1.5e101.5e10float (scientific)
true / yestrueboolean
false / nofalseboolean
(empty)nullnull
007"007"string (zeros kept)
Hello, world"Hello, world"string (quoted, has comma)
Plain textPlain textstring (unquoted)
12:34"12:34"string (colon needs quoting)

Strings are quoted only when YAML would otherwise misread them — saves a lot of visual noise compared to dumb “quote everything” serializers.

How to convert CSV to YAML in Python / yq / Ruby

When the no-code converter doesn’t fit (CI pipelines, repeatable transforms), here are the standard library paths.

Python — csv + PyYAML

import csv, yaml

with open("services.csv") as f:
    rows = list(csv.DictReader(f))

# Optional: cast types yourself — PyYAML's default dump won't.
for r in rows:
    r["replicas"] = int(r["replicas"])
    r["enabled"] = r["enabled"].lower() == "true"

with open("services.yaml", "w") as f:
    yaml.safe_dump(rows, f, sort_keys=False, default_flow_style=False)

yq (one-liner, command line)

# Requires Mike Farah's yq (Go), not the Python one.
yq -p csv -o yaml services.csv > services.yaml

yq is the fastest path in shell pipelines but its type detection is more conservative than the converter above — strings that look like numbers get auto-typed without a leading-zero guard.

Ruby

require "csv"
require "yaml"

rows = CSV.read("services.csv", headers: true).map(&:to_h)
File.write("services.yaml", rows.to_yaml)

Common CSV-to-YAML problems

Special characters need quoting

YAML treats :, #, [, ], {, }, ,, &, *, !, |, >, ', ", %, @, and backtick as syntax. A value like 12:34 (looks like a time) or # comment will break parsing if emitted raw. The converter above quotes any string containing these characters automatically.

Leading zeros lost (007, ZIP codes, phone numbers)

A naive csv → JSON → YAML pipeline turns "007" into 7. The converter above keeps any number with a leading zero (other than just 0 or 0.x) as a string. If you’re using a different tool, mark these columns as text manually.

Indentation matters

YAML is whitespace-sensitive — the converter uses 2-space indent consistently, which is what every major YAML consumer (Kubernetes, Ansible, GitHub Actions, Docker Compose) expects. Don’t hand-edit the output and mix tabs in. Tabs are illegal in YAML indentation; the parser will reject the file.

true/false/yes/no as actual strings

Got a CSV column where yes and no are real string values, not booleans? The converter will type them as booleans. Either rename the values (Y / N, or accepted / declined), or hand-edit the YAML to add quotes around those specific entries.

When to use YAML vs JSON vs TOML

FormatBest forAvoid for
YAMLConfigs, infrastructure-as-code, manifestsData interchange between APIs
JSONAPI payloads, machine-to-machineHuman-edited config files
TOMLApp configs (Rust, Python pyproject.toml)Deeply nested data

YAML’s strength is human readability with structure: it’s the default for Kubernetes, Helm, Ansible, GitHub Actions, GitLab CI, Docker Compose, and most modern infra tooling. JSON is the right pick when a machine writes and a machine reads. TOML wins for flat-ish app configs but gets ugly when nested.

If your CSV is going to a REST API, JSON is usually the better target — there’s no dedicated CSV→JSON tool here, but you can pipe through Excel or use the patterns shown above. If it’s going into a config file or a manifest, you’re in the right place.

Privacy: nothing is uploaded

The CSV-to-YAML conversion runs entirely in your browser using PapaParse for parsing and a small in-house YAML serializer. No file ever reaches a server — verify in DevTools → Network. Useful when your CSV contains internal hostnames, credentials, customer data, or anything you wouldn’t paste into a public converter.

Working with related formats? See /yaml-to-csv/ for the reverse, /json-to-csv/ for JSON sources, or /csv-to-xml/ for XML targets.

Related tools

Frequently asked questions

  • How do I convert CSV to YAML?

    Drop your CSV into the converter at the top of this page or paste the contents. Pick an output mode — list of objects or keyed map — and the YAML appears instantly. Copy it, or download as .yaml or .yml.

  • What's the difference between list of objects and keyed map?

    List of objects produces a YAML sequence: each row becomes a `- key: value` block. Keyed map turns one column into the top-level key — useful for Kubernetes ConfigMaps, Ansible host_vars, or any config where you look up entries by name rather than iterate them.

  • How are types handled?

    Integers, floats, and booleans (true/false/yes/no) are emitted unquoted so YAML parsers read them as the right type. Empty cells become null. Everything else is a string — quoted only when it contains YAML-special characters or looks like a number.

  • Should I use .yaml or .yml?

    Both work. The official recommendation from yaml.org since 2006 is .yaml. .yml is common in older Windows tooling and in projects like Ansible, Docker Compose, and GitHub Actions. Use whichever your project already uses — the converter outputs both.

  • Does it handle large CSV files?

    Yes — the parser (PapaParse) and the YAML serializer are both streaming-friendly and tested on files in the tens of MB. For multi-million-row CSVs, the bottleneck is the textarea rendering, not the conversion. Use the download button instead of viewing the output.

  • Is this useful for Kubernetes or Ansible configs?

    Yes — the keyed-map mode is built for exactly this. Convert a CSV of service names + replica counts into a values.yaml for Helm, or a CSV of hostnames + IPs into Ansible inventory variables. See examples below.

  • What about leading zeros (007, phone numbers)?

    Preserved as strings. A naive YAML serializer would turn '007' into the integer 7 — this one detects leading zeros and keeps them quoted. Same for ZIP codes starting with 0.

  • Is my CSV uploaded?

    No. The conversion runs entirely in your browser. Your data never reaches a server — verify in DevTools → Network. The page makes zero requests after it loads.