TFT

CSV to YAML Converter

From data tables to config files in one step. Convert CSV into clean YAML mappings with automatic type detection — ideal for seeding configuration files, test fixtures, or deployment manifests.

CSV to YAML Converter

Convert CSV data to YAML format with type inference options

Drag and drop a CSV file here, or click to browse

or paste CSV data below

Convert numbers and booleans automatically

Number of spaces for indentation

What This Converter Does

This tool transforms CSV data into YAML format. Each CSV row becomes a YAML mapping (dictionary), and all rows form a YAML list. Options include automatic type inference for numbers and booleans, plus configurable indentation (2, 4, or 8 spaces).

Example Conversion

Input CSV:

name,age,active,role
Alice,30,true,admin
Bob,25,false,user
Charlie,35,true,moderator

Output YAML (with type inference):

- name: Alice
  age: 30
  active: true
  role: admin
- name: Bob
  age: 25
  active: false
  role: user
- name: Charlie
  age: 35
  active: true
  role: moderator

Conversion Options

Type inference: Automatically converts values to appropriate YAML types. "30" becomes 30 (integer), "true" becomes true (boolean), empty cells become null.

Indentation: Choose 2, 4, or 8 spaces for nested indentation. 2 spaces is YAML convention and produces more compact output.

String escaping: Special characters in values are properly quoted and escaped for valid YAML syntax.

When to Use YAML

Configuration files: YAML is popular for app configuration (Docker Compose, Kubernetes, GitHub Actions, Ansible).

Static site generators: Jekyll, Hugo, and Gatsby use YAML for front matter and data files.

CI/CD pipelines: GitHub Actions, GitLab CI, and CircleCI use YAML for workflow definitions.

Data serialization: YAML is more human-readable than JSON for configuration and data that humans edit.

Infrastructure as code: Terraform, CloudFormation, and other IaC tools often use YAML for resource definitions.

Type Inference Details

When enabled, the converter analyzes each value:

Integers: "42", "-17", "0" become YAML integers.

Floats: "3.14", "-0.5", "1.5e10" become YAML floats.

Booleans: "true", "false", "yes", "no" (case-insensitive) become YAML booleans.

Null: Empty cells, "null", "NULL", "~" become YAML null.

Strings: Everything else stays quoted or unquoted as appropriate for YAML syntax.

YAML vs JSON for Configuration

YAML advantages: More readable (no braces or quotes needed for simple values), supports comments, cleaner for nested structures.

JSON advantages: Universally supported, stricter syntax (less ambiguity), faster to parse programmatically.

Use YAML when humans will read or edit the file. Use JSON when the file is primarily for machine consumption.

Limitations

Flat structure only: CSV is flat, so output is a list of flat mappings. Nested YAML structures require manual editing after conversion.

Complex types: YAML supports anchors, aliases, and multi-line strings. These aren't generated from simple CSV data.

File size: Works best with files under 20MB. Large files may cause slow performance in the browser.

Frequently Asked Questions

Does this handle special characters in values?

Yes. Values containing colons, quotes, or other YAML-special characters are properly quoted and escaped.

Can I convert YAML back to CSV?

This tool only converts CSV to YAML. For YAML to CSV, you'd need a separate tool or script that flattens YAML structures.

What indentation should I use?

2 spaces is the YAML community standard and produces the most compact output. 4 spaces is more readable for deeply nested structures.

Does this preserve UTF-8 encoding?

Yes. Output is UTF-8 encoded, preserving accented characters, emojis, and non-Latin scripts.