YAML to TOML Converter
Convert YAML to TOML online, for free, right in your browser. This YAML to TOML converter migrates configuration written in .yaml or .yml into TOML's table-based syntax, commonly used by Rust, Python, and modern CLI tools. Nested mappings become TOML tables, and arrays of mappings become array-of-tables.
Drop your YAML file here
or
Supports .yaml and .yml files, processed entirely on your device
YAML →JSON
Your converted output will appear here.Conversion notes
What to expect
- Nested objects are written as [section.subsection] tables.
- Arrays of mappings become [[array-of-tables]] entries.
- Null values are written as empty strings, since TOML has no native null.
Example
site:
name: Aperture Docs
version: 1.4.2
active: true
tags:
- web
- cli
- tools
author:
name: Jane Doe
email: jane@example.com
tags = ["web", "cli", "tools"]
[site]
name = "Aperture Docs"
version = "1.4.2"
active = true
[author]
name = "Jane Doe"
email = "jane@example.com"
When TOML is the better config format
TOML was designed for configuration files that humans edit, and it has become the default in several ecosystems: Cargo.toml for Rust, pyproject.toml for Python packaging, and config files for tools such as Hugo and Netlify. If you are moving a project into one of those ecosystems, converting your existing YAML settings is faster than retyping them.
Unlike YAML, TOML doesn't depend on indentation. Structure comes from explicit [table] headers, which removes a whole class of whitespace mistakes. The trade-off is that deeply nested data can look repetitive, which is why this converter uses dotted headers and arrays of tables to keep the result tidy.
Python packaging
Draft the settings for pyproject.toml from an existing YAML-based tool config.
Rust and Cargo
Move structured settings into a format Cargo and its tooling already understand.
Static site generators
Port a Hugo or similar site configuration between YAML and TOML.
Avoiding indentation bugs
Switch a fragile whitespace-sensitive file to explicit table headers.
How YAML maps to TOML
These are the exact rules this converter applies. Each result below was generated by the tool itself, so it matches what you will see in the output panel.
Top-level values and tables
Plain keys come first, then each nested mapping becomes a [table] section.
title: App
server:
port: 8080title = "App"
[server]
port = 8080Deep nesting uses dotted headers
Intermediate tables that hold only other tables are collapsed into a single dotted header.
a:
b:
c: 1[a.b]
c = 1Lists of mappings become arrays of tables
Each item gets its own [[double-bracket]] header, repeated once per entry.
users:
- name: ada
- name: alan[[users]]
name = "ada"
[[users]]
name = "alan"Simple lists stay inline
Lists of scalars are written as inline arrays on one line.
ports: [80, 443]
regions:
- eu
- usports = [80, 443]
regions = ["eu", "us"]A trickier example: nulls, nested tables and job lists
This deployment-style config mixes nested tables, an inline array, a null certificate and a list of job definitions.
title: Deploy config
server:
host: 0.0.0.0
ports: [80, 443]
tls:
enabled: true
cert: null
jobs:
- name: build
steps: 3
- name: test
steps: 5title = "Deploy config"
[server]
host = "0.0.0.0"
ports = [80, 443]
[server.tls]
enabled = true
cert = ""
[[jobs]]
name = "build"
steps = 3
[[jobs]]
name = "test"
steps = 5TOML has no null type, so the missing certificate is written as an empty string and flagged in the notes. The nested tls table keeps its full dotted path, and each job gets its own array-of-tables entry.
- TOML has no null value; null fields were written as empty strings.
Reading the TOML in your code
Python 3.11 and later include a TOML parser in the standard library. Note that the file must be opened in binary mode:
import tomllib
with open("config.toml", "rb") as f:
config = tomllib.load(f)
print(config["server"]["host"])
for job in config["jobs"]:
print(job["name"], job["steps"])YAML vs TOML at a glance
TOML trades YAML's flexibility for predictability.
| Feature | YAML | TOML |
|---|---|---|
| Structure | Indentation | Explicit [table] headers |
| Null values | Supported (null or ~) | Not supported |
| Comments | # comment | # comment |
| Dates and times | Parsed as strings here | Native date-time type |
| Typical use | Pipelines, Kubernetes, CI | Package and tool settings |
Things to watch for when converting to TOML
- TOML has no null, so null fields become empty strings; decide whether to remove those keys instead.
- The document root must be a table, so a top-level YAML list is wrapped under a single "value" key.
- YAML comments are not carried over; re-add any explanatory comments in the TOML file by hand.
- Dates and timestamps are written as quoted strings rather than native TOML date-times.
YAML to TOML Converter FAQ
Does TOML support null values?
No. TOML has no null type, so null fields are written as empty strings and flagged in the conversion notes.
How are nested YAML objects handled?
Nested mappings are converted into dotted TOML table headers, such as [server.database].
Is my configuration file uploaded anywhere?
No. Parsing and conversion both happen locally in your browser.
Why was my null value turned into an empty string?
TOML does not define a null type, so there is no faithful way to express it. The converter writes an empty string and notes the substitution; you may prefer to delete the key altogether.
Will the output work in pyproject.toml or Cargo.toml?
The syntax is valid TOML, but those files expect specific table names such as [project] or [dependencies]. Convert your data, then arrange it under the headers your tool requires.
How are lists of objects written?
Each object in a list becomes its own [[array.of.tables]] block, repeating the header once per item, which is the idiomatic TOML way to represent a list of records.
Is there a difference between .yml and .yaml?
No. ".yml" and ".yaml" are just two file extensions for the exact same format — this converter accepts either one, so a "yml to TOML" conversion and a "yaml to TOML" conversion produce identical results.
Related conversions
YAML to INI
Simpler tooling that only understands sections and keys? INI is the lowest common denominator.
Try itYAML to JSON
Need the same settings in a machine-friendly format for an API or script.
Try itYAML to Properties
Working in Java or Spring? Flatten the configuration into key=value pairs.
Try itGetting an error? Check your input with theYAML Validator, or tidy it first with theYAML Formatter. You can also browse all YAML converters.