Skip to content
Convert Filez
Data And FormatsRuns in your browser4 min read

CSV to YAML Converter

This CSV to YAML converter takes a table with a header row and emits a YAML sequence, one mapping per row, with keys taken from the headers. Indentation, key order and type detection are all under your control, and the result is produced by a real YAML serialiser rather than string concatenation.

Loading the tool interface
Files never leave your deviceNo upload wait and no queueNo signup, watermark or file limit

YAML is the format configuration lives in. Kubernetes manifests, CI pipelines, Ansible inventories, Rails fixtures and static site data files are all YAML, while the source of that data is very often a spreadsheet somebody maintains. Converting bridges the gap without a hand editing pass that introduces typos.

The conversion runs entirely in your browser. No row is uploaded, which matters when the spreadsheet holds hostnames, credentials adjacent metadata or anything else you would not paste into an unknown web service.

When you should convert CSV to YAML

Reach for it whenever a human is going to read the result. YAML has no punctuation noise, it supports comments, and a reviewer can see exactly which line changed in a diff. That makes it the right shape for configuration and seed data that lives in version control.

The reverse is true for machine to machine transfer. If the data is going to an API or a JavaScript application, JSON is smaller, faster to parse and unambiguous. YAML earns its keep on readability, not on efficiency.

  • You are generating fixtures, seed data or test data for a repository.
  • The output goes into a CI configuration or a deployment manifest.
  • A static site generator reads data files from a data directory.
  • Reviewers need to see the change as a readable diff.
  • Prefer JSON when the consumer is an API or a browser application.

Quoting, indentation and the Norway problem

YAML looks forgiving and is not. A bare value such as no, on, off or yes is interpreted as a boolean by many parsers, which is why the country code NO has broken more configuration files than any other two letters. Version numbers like 1.10 lose their trailing zero when read as a float, and a leading zero can be read as octal.

The serialiser used here quotes any value that would otherwise change meaning, so a string stays a string. When type detection is switched off, every cell is emitted as a quoted string, which is the safest setting if you are unsure what the downstream parser will do.

Indentation is significant in YAML, so the tool lets you pick two or four spaces and applies it consistently. Tabs are never emitted, because the specification forbids them for indentation.

How this CSV to YAML converter reads your file

The CSV is parsed by a character by character state machine that implements RFC 4180. Quoted fields keep their commas, their embedded line breaks and their doubled quote escapes, which is exactly where a naive split on commas destroys the data.

Each row becomes a mapping whose keys are the header names. Blank headers become positional keys, duplicate headers are made unique with a numeric suffix, and rows shorter than the header are padded so every mapping has the same set of keys. A multi line cell is emitted as a YAML block scalar so it stays readable.

Choosing keys, order and nesting

By default keys appear in the order the columns appear, because that is usually the order a person thinks about the data. Sorting keys alphabetically is available and is worth turning on when the output will be diffed repeatedly, since a stable order keeps diffs small when columns are added.

This tool produces a flat mapping per row and does not invent nesting. If you need nested structures, convert to a flat YAML sequence first and then reshape it, or produce JSON and nest it there. Guessing at hierarchy from column names such as address.city is convenient right up until a column legitimately contains a dot.

Working with large sheets and unusual encodings

There is no upload step, so a large export converts as fast as your machine can read it. A search for a csv to yml service usually lands on something that would have copied your file to a server first, and the wait is the upload rather than the work.

Encoding is the one thing to check before you start. Spreadsheet applications on Windows still export in a legacy code page by default, and those bytes arrive as replacement characters. Re save as UTF-8 and the accents, symbols and non Latin scripts survive. Once the file is clean, producing yaml from spreadsheet data is a single pass with nothing left to tidy by hand.

How to convert CSV to YAML

  1. 1

    Add the CSV

    Paste the table or drop a .csv file. The first row is read as the key names for every mapping.

  2. 2

    Set indentation and key order

    Choose two or four space indentation, and decide whether keys keep column order or are sorted alphabetically.

  3. 3

    Decide on type detection

    Leave it on to write numbers and booleans as native YAML scalars, or switch it off to quote every value as a string.

  4. 4

    Convert and save

    Press convert, read the preview, then copy the YAML or download it as a .yaml file.

Related tools worth bookmarking

Sources and further reading

Frequently asked questions

Common questions about the csv to yaml converter.

Because without quotes they would change meaning. Values such as no, yes, on, off and version numbers with trailing zeros are read as booleans or floats by YAML parsers, so the serialiser quotes them to keep them as the strings they were.

No, it produces one flat mapping per row with keys taken from the headers. Inferring hierarchy from dotted column names looks helpful until a column legitimately contains a dot, so the tool leaves reshaping to you.

It is emitted as a YAML block scalar, which preserves the line breaks and keeps the file readable. That is only possible because the CSV parser handles newlines inside quoted fields correctly rather than treating them as row boundaries.

Yes. The delimiter selector accepts tab, semicolon and pipe as well as comma, which covers most exports from spreadsheets, databases and reporting tools. The rest of the conversion is identical whichever delimiter you choose.

It is produced by a standards compliant serialiser and parses cleanly under YAML 1.2 loaders. Some very old tools implement YAML 1.1, where a few unquoted values behave differently, which is another reason the safe quoting default is worth keeping.

Keep going

More data and formats

View the full category