Convert CSV to YAML
Convert CSV data to YAML format. First row becomes keys, each subsequent row becomes a YAML mapping. 100% client-side.
Paste your CSV and get valid YAML back — header row becomes keys, each data row becomes a mapping with correct indentation and quoting. Handles commas inside quoted fields, type inference for numbers and booleans, and all the edge cases that break manual conversion.
And everything runs in your browser. Nothing gets uploaded.
How It Works
The parser splits your CSV following RFC 4180 rules — so quoted fields with commas, newlines, and escaped quotes all work correctly. Each row becomes a YAML list item, with the header values as keys. If type inference is on, numbers stay unquoted, booleans become true/false, and strings with special characters get wrapped in quotes automatically.
Examples
Simple Contact List
Turning a basic contacts spreadsheet into YAML for a static site data file.
name,email,role
Alice Chen,[email protected],Engineer
Bob Patel,[email protected],Designer
- name: Alice Chen
email: [email protected]
role: Engineer
- name: Bob Patel
email: [email protected]
role: Designer
Server Inventory with Numeric Ports
Exporting a server list from a spreadsheet into YAML for an Ansible inventory. Type inference keeps port numbers unquoted.
host,port,active
web-01.prod,8080,true
db-01.prod,5432,true
cache-01.prod,6379,false
- host: web-01.prod
port: 8080
active: true
- host: db-01.prod
port: 5432
active: true
- host: cache-01.prod
port: 6379
active: false
Product Data with Commas in Values
A product catalog where descriptions contain commas. The RFC 4180 parser handles the quoted fields without breaking.
sku,name,price
W-100,"Widget, Standard",12.99
W-200,"Widget, Deluxe",24.50
- sku: W-100
name: "Widget, Standard"
price: 12.99
- sku: W-200
name: "Widget, Deluxe"
price: 24.5
Who Uses This
Converting exported server lists and environment configs into YAML for Ansible, Kubernetes, or Docker Compose files.
Turning database query results or seed data CSVs into YAML fixtures for testing.
Reformatting spreadsheet exports to feed into YAML-based data pipelines or config-driven reports.
Learning YAML syntax by seeing how tabular data maps to key-value pairs and lists.
Common Mistakes
The converter expects the first row to be column names. If your CSV starts with data instead of headers, every key in the output will be wrong. Add a header row before converting.
Values like true, off, or 3.14 get converted to YAML booleans and numbers by default. If you need them as literal strings (say, a password that happens to be "true"), uncheck type inference.
This tool expects comma-separated values. If you paste TSV data, the whole line shows up as a single field. Replace tabs with commas first, or use a dedicated TSV converter.
Technical Details
- Processing: 100% client-side JavaScript — no server round-trips
- CSV Parsing: RFC 4180 compliant (quoted fields, escaped quotes, embedded newlines)
- Type Inference: Integers, floats, booleans (true/false/yes/no/on/off), and null
- Indent Options: 2, 4, or 8 spaces
- Browser Support: Chrome, Firefox, Safari, Edge
Frequently Asked Questions
Can I convert YAML back to CSV?
Not with this tool — it's one-way, CSV to YAML. For the reverse, check out a YAML-to-JSON converter and then JSON-to-CSV. Or look for a dedicated YAML-to-CSV tool if you need it often.
What happens to empty cells in my CSV?
Empty cells become empty strings in the YAML output (key: ""). If you have type inference on, they still stay as empty strings — the converter won't turn blanks into null unless you edit the output manually.
Is there a row limit?
No hard limit. Since everything runs in the browser, it depends on your machine's memory. A few thousand rows should be fine. If you're working with tens of thousands of rows, a command-line tool like yq would be faster.
Does the output work with Kubernetes or Docker Compose?
The YAML it produces is valid and parseable by any YAML 1.2 reader. That said, Kubernetes and Docker Compose expect specific schemas. You'll likely need to restructure the output to fit the required format — but the data conversion part is handled for you.
Is my CSV data private?
Yes. The conversion happens entirely in JavaScript inside your browser tab. Nothing is sent to any server, logged, or stored. Close the tab and it's gone.