Home › Developer Tools › CSV to YAML Converter

CSV to YAML Converter

Paste CSV or open a .csv file and get clean YAML: each row becomes a mapping in a list, header cells become keys, and numbers, true/false and empty cells are typed the way you choose. Strings that YAML would misread, like no, 0755 or 2024-01-15, are quoted for you.

Last updated:

Your CSV is converted in this tab and never uploaded. Tip: drop a file on the input box, or press Ctrl + Enter to convert.

Advertisement
Advertisement

How to use the CSV to YAML Converter

  1. Paste your CSV into the left box, or open or drop a .csv/.tsv file. A sample loads so you can see the result right away.
  2. Check the delimiter and header settings. Auto-detect picks the separator that splits the rows most consistently.
  3. Choose how values are typed: detect numbers and booleans, keep zip codes like 00501 as text, and pick what empty cells become.
  4. Pick an output shape, such as a list of mappings for Ansible vars or a mapping keyed by ID for config lookups.
  5. Copy or download the YAML. It updates as you type or change an option.

Example: CSV to YAML

This CSV with a header row:

id,name,active,zip,address.city
1,Ada Lovelace,true,00501,London
2,Alan Turing,false,10001,Manchester

becomes, as a list of mappings with type detection and dot nesting:

- id: 1
  name: Ada Lovelace
  active: true
  zip: '00501'
  address:
    city: London
- id: 2
  name: Alan Turing
  active: false
  zip: 10001
  address:
    city: Manchester

The zip code 00501 is quoted so it keeps its leading zeros, while 10001 is a real number. Choose Mapping keyed by first column instead and the rows are indexed by ID ("1":, "2":), which is convenient for lookups in config files.

Values YAML can misread, and how they are written

CSV cellUnquoted YAML would read it asWritten as
no, yes, on, offBoolean (YAML 1.1 parsers such as PyYAML)'no'
0755, 0x1F, 1e3Number (octal, hex, scientific)'0755' (kept as text)
2024-01-15Date / timestamp'2024-01-15'
12:30Base-60 number 750 in YAML 1.1'12:30'
#generalA comment (the value disappears)'#general'
key: value inside a cellA nested mapping, or a syntax error'key: value'
Empty cellnullnull, "" or omitted (your choice)
Text over two linesNeeds block or escaped style|- block literal

Tips

  • Ansible and Helm values: use a root key (for example users) so the list can be referenced as a variable or under a chart value.
  • Exporting from Excel or Google Sheets: save as CSV UTF-8 so accented characters survive. Semicolon-separated exports from European locales are detected automatically.
  • Check the result with the YAML Validator, or turn JSON into YAML with the JSON to YAML Converter.

Frequently asked questions

How is a CSV row represented in YAML?

Each data row becomes a mapping whose keys are the header cells, and all rows together form a sequence (a list), written with a dash before each item. A header id,name and a row 1,Ada becomes - id: 1 followed by an indented name: Ada line.

Why are some values wrapped in quotes?

YAML gives unquoted text a type. Words like yes, no, on and off become booleans in YAML 1.1 parsers, 1e3 and 0x1F become numbers, 2024-01-15 can become a date and a value starting with # becomes a comment. The converter quotes such strings so they stay exactly as they were in the CSV; with type inference on, only real numbers, true/false and null are left unquoted on purpose.

What happens to leading zeros like 00501 or 007?

With Keep leading zeros as text checked, they are written as quoted strings, so zip codes, product codes and phone numbers keep every digit. Uncheck it to turn them into plain numbers (501 and 7).

How are empty cells converted?

You choose: null (the YAML null value), an empty string written as two quotes, or leaving the key out of that row entirely. Leaving it out is handy when the YAML feeds a tool that applies its own defaults for missing keys.

Can I create nested YAML from a flat CSV?

Yes. Check Nest keys with dots and name columns like address.city and address.country; they become an address mapping with city and country inside it. If a column clashes with a nested one, it is kept as a flat key and a note explains why.

What if my CSV has no header row?

Uncheck First row is the header. Every row is then converted and the keys are named column_1, column_2 and so on, which you can rename afterwards.

Is my data uploaded?

No. Parsing and conversion happen in JavaScript inside your browser tab, so the CSV never leaves your device. It also works offline once the page has loaded.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.CSV to JSONConvert CSV data to JSON with live preview.XML to YAML ConverterConvert XML to clean YAML with attributes, text nodes, lists and exact error lines.YAML Validator & FormatterValidate, format and minify YAML, and convert YAML to JSON or back.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.TOML to JSON ConverterConvert TOML to JSON and JSON to TOML with a full v1.0 parser and clear error lines.JSON to Go StructTurn JSON into Go structs with inferred types, nested structs and json tags.JSON to Python ClassGenerate Python dataclasses, Pydantic models or TypedDicts with type hints from JSON.Excel to SQL ConverterTurn an Excel sheet into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.Excel to VCF ConverterTurn an Excel contact list into a vCard .vcf file for iPhone, Android, Google or Outlook.File to C ArrayConvert any file into a C or C++ byte array header, like xxd -i, with const and PROGMEM options.Image to C ArrayConvert images to monochrome, RGB565 or RGB888 C arrays for OLED, LCD and TFT displays.JSON Merge ToolDeep-merge two or more JSON objects with array concat, replace or union and a conflict rule.JSONL to CSV ConverterConvert JSON Lines / NDJSON to CSV with flattened columns; streams large files locally.PHP Unserialize OnlineDecode PHP serialize() strings to JSON, a tree or print_r, and serialize JSON back to PHP.SQL Dialect ConverterTranslate SQL between MySQL, PostgreSQL, SQLite, SQL Server, Oracle, BigQuery and more.TSV to JSON ConverterTurn tab-separated data pasted from Excel or Sheets into a JSON array or keyed object.XLS to XLSX ConverterConvert old Excel 97-2003 .xls workbooks to modern .xlsx files in your browser, several at once.XML to Excel ConverterTurn repeating XML elements into an .xlsx spreadsheet with attributes and nested data as columns.XSD to XML Sample GeneratorGenerate a sample XML document from an XSD schema, with types, attributes and namespaces.YAML to CSV ConverterTurn a YAML list of objects into CSV with dot-notation columns, custom column order and download.DOCX to Markdown ConverterConvert Word .docx to clean Markdown with headings, lists, tables, links and images in a ZIP.ES6 to ES5 ConverterTranspile modern JavaScript (ES2015+) to ES5 with Babel: targets, module format and loose mode.JavaScript Object to JSONTurn JS object literals and Python dicts into valid JSON: quotes keys, fixes commas and values.JSON Graph VisualizerSee JSON as an interactive node graph with zoom, collapse and search; export PNG or SVG.KML ViewerOpen KML and KMZ files on an interactive map: placemarks, paths, polygons, folders, export.MySQL to PostgreSQL ConverterConvert MySQL dumps and CREATE TABLE statements to PostgreSQL: types, AUTO_INCREMENT, ENUMs, quotes.Text to CSV ConverterTurn space-aligned, fixed-width, pipe or tab separated text into clean CSV with a live preview.VCF File ViewerOpen vCard .vcf files as contact cards with photos, search and duplicate check, export CSV.XML ViewerBrowse XML as a collapsible tree with search, XPath of any node, attributes and big-file support.JSON to C# ClassConvert JSON to C# classes or records with System.Text.Json or Newtonsoft attributes.JSON SorterSort JSON keys A-Z recursively, sort arrays by value or by a key, then pretty-print or minify.JSON to HTML TableConvert a JSON array of objects into clean HTML table code with CSS styles and a live preview.CSV to SQL ConverterConvert CSV to SQL CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server.IPv4 to IPv6 ConverterConvert IPv4 to IPv4-mapped, 6to4 and NAT64 IPv6, extract IPv4 from IPv6, and get int/hex/binary.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.Code to ImageTurn code into a beautiful syntax-highlighted PNG with themes, window frame and background.Excel to JSON ConverterConvert Excel sheets (XLSX, XLS, ODS) to JSON with header row, type and shape options.
See all 129 Data & File Format Converters →