Skip to the tool
ViewCSV
Files stay on your device

Convert CSV to YAML

orders.csv· SAMPLE DATA15 rows · 8 columns
Value types
Text values that look like numbers, true/false or dates are quoted, so they read back as the same text.
- order_id: "001041"
  customer: Liam Garcia
  city: Austin
  product: Desk lamp
  quantity: "6"
  unit_price: "142.72"
  order_date: "2026-01-09"
  status: paid
- order_id: "001042"
  customer: Mary Clark
  city: Seattle
  product: Monitor 27"
  quantity: "5"
  unit_price: "210.76"
  order_date: "2026-02-03"
  status: shipped
- order_id: "001043"
  customer: Henry Taylor
  city: Denver
  product: Notebook A5
  quantity: "1"
  unit_price: "143.74"
  order_date: "2026-03-25"
  status: pending
- order_id: "001044"
  customer: Lucas Smith
  city: Chicago
  product: Monitor 27"
  quantity: "5"
  unit_price: "137.00"
  order_date: "2026-04-25"
  status: shipped
- order_id: "001045"
  customer: Noah Davis
  city: Seattle
  product: USB-C cable
  quantity: "7"
  unit_price: null
  order_date: "2026-05-11"
  status: refunded
- order_id: "001046"
  customer: Emma Williams
  city: Portland
  product: Notebook A5
  quantity: "6"
  unit_price: "166.44"
  order_date: "2026-06-10"
  status: pending
- order_id: "001047"
  customer: " Henry Taylor "
  city: New York
  product: Monitor 27"
  quantity: "7"
  unit_price: "57.53"
  order_date: "2026-07-14"
  status: pending
- order_id: "001048"
  customer: Lucas Jones
  city: Austin
  product: Desk lamp
  quantity: "7"
  unit_price: "194.19"
  order_date: "2026-08-03"
  status: pending
- order_id: "001049"
  customer: Olivia Williams
  city: Austin
  product: USB-C cable
  quantity: "5"
  unit_price: "190.03"
  order_date: "2026-09-07"
  status: pending
- order_id: "001050"
  customer: Mary Wilson
  city: New York
  product: Chair, ergonomic
  quantity: "8"
  unit_price: "61.04"
  order_date: "2026-01-15"
  status: pending
- order_id: "001051"
  customer: Noah Williams
  city: Portland
  product: Chair, ergonomic
  quantity: "2"
  unit_price: "61.37"
  order_date: "2026-02-25"
  status: refunded
- order_id: "001052"
  customer: Mia Smith
  city: Boston
  product: Monitor 27"
  quantity: "5"
  unit_price: "231.42"
  order_date: "2026-03-09"
  status: refunded
- order_id: "001053"
  customer: Ava Garcia
  city: Boston
  product: USB-C cable
  quantity: "3"
  unit_price: "201.24"
  order_date: "2026-04-05"
  status: pending
- order_id: "001054"
  customer: Mary Clark
  city: Boston
  product: Desk lamp
  quantity: "5"
  unit_price: "35.49"
  order_date: "2026-05-12"
  status: pending
- order_id: "001043"
  customer: Henry Taylor
  city: Denver
  product: Notebook A5
  quantity: "1"
  unit_price: "143.74"
  order_date: "2026-03-25"
  status: pending

15 rows · 1 file

Open or paste a CSV file and each row becomes one item in a YAML list, keyed by the header. By default every value stays text, and values a YAML parser would otherwise reinterpret — NO, yes, 0150, 2024-03-01, null — are quoted so they load back exactly as written. The file is converted in your browser and never uploaded.

How to convert CSV to YAML

  1. Select Open file, drop a .csv, .tsv or .txt file on the tool, or choose Paste. Check the delimiter and encoding under Import settings if the keys look wrong.
  2. Choose Value types and how Empty cells are written. The YAML tab shows the exact text the download will contain.
  3. Pick the Indentation, then select Copy or Download YAML.

The result is a top-level sequence (- key: value items), the shape used for fixtures, seed data and static-site data files. If you need JSON instead, CSV to JSON has the same type options.

YAML output options

Keep every value as textThe default. Every value is a YAML string; quotes are added only where a plain scalar would be read as something else.
Detect numbers and true/falseA column becomes YAML numbers only if every non-empty value is a plain number without leading zeros and with at most 15 significant digits; true/false columns (any case) become booleans. yes/no and dates stay quoted strings. Numbers are written in canonical form, so 1.50 becomes 1.5.
Empty cellsnull (the default) writes key: null; Empty text "" writes key: ""; Leave the key out drops that key from the row.
Indentation2 spaces (default) or 4 spaces for keys under each list item.

How ambiguous values are quoted

The output is written to read back the same in YAML 1.2 parsers and in older YAML 1.1 parsers such as PyYAML, which treat more words as booleans and numbers.

  • Country and answer codes: NO, yes, off, y and on are quoted, so Norway’s code is not loaded as false. This applies to keys too ("on": x).
  • Leading zeros: 0150 and 08001 are quoted; unquoted, YAML 1.1 reads them as octal or decimal numbers and drops the zero.
  • Dates and numbers in text mode: 2019-04-01 and 12 are quoted so they are not loaded as a timestamp or an integer.
  • Null-like text: a cell containing null or ~ is quoted, so it stays the text you wrote and is not confused with an empty cell.
  • Line breaks inside a value become a |- literal block, and : or # inside text is quoted. Long lines are never folded.
  • Headers are used as keys exactly as written, including spaces and non-Latin scripts. A blank header becomes Column 3 and a repeated one name (2).

Common CSV to YAML problems

  • A number column stayed quoted with Detect numbers and true/false. At least one value is not a plain number, for example 1,5, 12 kg or 007. Find it in the CSV viewer.
  • A yes/no column did not become booleans. Only true and false are converted, because yes, no and on mean booleans only in YAML 1.1. Replace them first with the text tools in the CSV editor if you need booleans.
  • Keys contain odd characters such as é. The file is not UTF-8. Choose its encoding under Import settings.
  • Everything is under one key. The delimiter was guessed wrong; set it under Import settings.

Limits and privacy

Files up to 25 MB, 100,000 rows or 2 million cells open with a live preview of the first 200 rows. Larger files are converted in streaming mode: the file is read twice in chunks (once to measure the columns and their types, once to write), a notice says the download covers the whole file, and Copy is not offered. A single output file is capped at 4 GB.

The conversion runs in a background worker in this tab, so the page stays responsive and Cancel stops it. The CSV is never sent to a server.

Example: a customer list with country codes and postcodes

A customer list with country codes, postcodes with leading zeros, yes/no flags, dates and empty cells, converted with the default settings (all text, empty cells as null). With Detect numbers and true/false, only orders changes, to 12, 3 and 7.

CSV
country,code,postcode,vat_registered,since,orders
Norway,NO,0150,yes,2019-04-01,12
Spain,ES,08001,no,2021-11-15,3
United States,US,02134,,,7
YAML
- country: Norway
  code: "NO"
  postcode: "0150"
  vat_registered: "yes"
  since: "2019-04-01"
  orders: "12"
- country: Spain
  code: ES
  postcode: "08001"
  vat_registered: "no"
  since: "2021-11-15"
  orders: "3"
- country: United States
  code: US
  postcode: "02134"
  vat_registered: null
  since: null
  orders: "7"

Questions and answers

Why is `NO` in quotes?

In YAML 1.1, unquoted NO, no, off and n mean false. Quoting keeps a Norwegian country code, or any answer written as no, as text in every parser.

Can I get one mapping keyed by an ID instead of a list?

No. Each CSV row is written as one list item, in file order. Keyed output is not available here.

Is the output valid YAML 1.2?

Yes. The extra quoting needed for YAML 1.1 is still valid YAML 1.2; it only makes values that were already strings explicit.

Standards and references