Skip to content

CSV to YAML converter

CSV to YAML turns each parsed CSV row into one YAML sequence item, with multiline fields written as block scalars when the YAML writer chooses that style.

  • Converted with Table engine · nothing stored
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • Row shape Changed

    Each CSV record became one item in a YAML sequence keyed by the CSV headers.

  • Multiline notes Changed

    The note line one and line two was serialized as a YAML block scalar with the |- indicator.

  • Empty cells Changed

    Blank CSV cells became null in YAML, including the missing cells from the ragged final row.

  • Quoted thousands value Kept

    The quoted 1,234.50 amount stayed text in YAML because the comma prevented simple numeric inference.

  • Boolean values Changed

    true and false source strings became YAML booleans without quotes.

  • Date text Changed

    ISO-looking dates were emitted as full UTC timestamp values rather than the shorter source strings.

Sample conversions

Block scalar note

Input
CSV row included "line one\nline two" in the note column and an empty trailing cell.
Output
YAML wrote note: |- followed by indented line one and line two, then empty: null for the blank cell.

Ragged record

Input
The final row was 003,Zoë with no remaining fields.
Output
YAML wrote id: 3, name: Zoë, and null for note, zip, active, amount, date, and empty.

A real CSV → YAML run

We converted our CSV sample (226 B) with Table engine on 2026-09-11. It took 2 ms and produced a 447 B YAML file, 2.0× larger than the input. The engine raised no warnings.

Input · sample.csv · 226 B

4 data rows × 5 columns; header: company,stage,arr,owner,close_date

Rows
4
Columns
5
Header
company,stage,arr,owner,close_date

Output · sample.yaml · 447 B

4 list items, 0 top-level keys, 20 lines

List items
4
Top-level keys
0
Lines
20

First lines of the output

yaml
- company: Northwind Traders
  stage: Proposal
  arr: 48000
  owner: R. Ayers
  close_date: 2026-10-14T00:00:00.000Z
- company: Contoso Ltd
  stage: Negotiation
  arr: 120000
  owner: P. Ng
  close_date: 2026-09-30T00:00:00.000Z
- company: Fabrikam
  stage: Qualified
  arr: 22500
  owner: R. Ayers
  close_date: 2026-11-02T00:00:00.000Z
- company: Tailspin Toys
  stage: Won
  arr: 64000
…

Options and when to change them

delimiter
Set this when the CSV-like input uses semicolons, pipes, or tabs.
header
Keep it enabled for object-style YAML keyed by the first row; disable it for generated column names.
quote
Change the quote character only for a documented nonstandard CSV dialect.
encoding
Use latin1 for old exports before YAML is written, because YAML output is UTF-8 text.

Do it yourself

Python csv and PyYAML

bash
python - <<'PY'
import csv, yaml
with open("input.csv", newline="", encoding="utf-8-sig") as f:
    rows = list(csv.DictReader(f))
with open("output.yaml", "w", encoding="utf-8") as out:
    yaml.safe_dump(rows, out, allow_unicode=True, sort_keys=False)
PY

DictReader keeps blanks as empty strings unless you normalize them to None before dumping YAML.

CSV to YAML by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=csv&to=yaml.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.csv" -F "from=csv" -F "to=yaml" \
  -F 'options={"delimiter":","}' \
  --output output.yaml

Options this engine accepts for CSV → YAML

KeyApplies toTypeDefault
delimiterReading CSVstring,
headerReading CSVbooleantrue
quoteReading CSVstring"
encodingReading CSVutf-8 · latin1utf-8
delimiterWriting YAMLstring,
newlineWriting YAML ·
sheetNameWriting YAMLstring
dialectWriting YAMLpostgres · mysql · sqlitepostgres
tableNameWriting YAMLstringdata
createTableWriting YAMLbooleantrue
API reference

When this is the wrong conversion

  • Do not use YAML if the receiving system requires a declared schema or database-ready column types.
  • If leading zero identifiers must survive automatically, JSON from a text-preserving parser may be safer than this typed CSV path.

CSV to YAML questions

Why did CSV blanks become YAML null?

Our table engine maps blank cells to null before YAML serialization. That makes missing data explicit, but it differs from an empty string value.

How are multiline CSV fields written in YAML?

Our sample note became a block scalar using |-. That format keeps the line break readable while still representing one field.

Can CSV to YAML keep the original column order?

Yes for the rows we tested. The YAML writer followed the header order from the CSV table when writing each sequence item.