YAML to TOML Converter
Paste YAML on the left, get TOML on the right. The entire conversion runs in your browser — nothing is uploaded.
YAML to TOML Converter
Before you start
You need a valid YAML document where the root level is a mapping (a set of key-value pairs). TOML doesn't support top-level lists or single values, so if your YAML looks like - item 1 or just "hello", the conversion will fail. If you have a list, wrap it in a key like data: [...] first.
Check your YAML for null values or empty keys. TOML 1.0 has no native "null" type, so those values can't be represented and will throw an error during the conversion process.
There is no file size limit other than what your browser can handle in memory. I've tested it with reasonably large config files, and since it runs entirely on your machine, it's usually quite snappy.
How to use it
- Paste your YAML into the left pane, or drag and drop a
.yamlor.ymlfile directly onto the editor. - Click Run to perform the conversion.
- Review the resulting TOML in the right pane — if there's a syntax error in your YAML, a message with the line number will appear in the status bar.
- Click Copy result to grab the output, or use Clear to start over.
Example
Input (YAML):
title: "App Config"
database:
enabled: true
ports:
- 5432
- 5433
services:
- name: "api"
cpu: 2
Output (TOML):
title = "App Config"
[database]
enabled = true
ports = [ 5432, 5433 ]
[[services]]
name = "api"
cpu = 2
Notice how the YAML sequence of mappings for services is automatically converted into a TOML array of tables ([[services]]).
Tips & common pitfalls
- Root must be a map. I mentioned this before, but it's the #1 reason for "failed to convert" errors. TOML is a hash map by definition.
- Nulls are a no-go. YAML's
null(or~) doesn't exist in TOML 1.0. You'll need to remove those keys or change them to strings or booleans before converting. - Anchors and Aliases are flattened. If you use
&anchorand*aliasin your YAML, they will be resolved into literal copies in the TOML output. TOML has no equivalent for internal references. - Dates round-trip nicely. YAML timestamps are parsed as real
Dateobjects and emitted as TOML offset datetimes, so your configuration dates stay functional. - First document only. If your YAML file uses
---to separate multiple documents, only the first one gets converted.
Troubleshooting
I get an error about a "top-level mapping" being required.
Your YAML likely starts with a dash (-), making it an array. TOML requires a key-value structure at the root. Nest your array under a key (e.g., items: [your list]) and it will convert just fine.
The conversion failed with a "Cannot serialize null" message.
TOML simply doesn't have a null type. You'll need to either delete the key that has a null value or change it to an empty string ("") or a placeholder value.
My multi-line YAML strings look messy in TOML.
TOML handles multi-line strings differently. The converter will do its best to use basic or literal strings, but complex YAML block scalars might end up formatted as standard quoted strings with \n escapes if they contain tricky characters.
Related tools
See also: if you need to do something adjacent on this site, try TOML to YAML to convert TOML to YAML, JSON to TOML to convert JSON to TOML, or TOML to JSON to convert TOML to JSON.
Frequently asked questions
Does this handle YAML anchors and aliases?
Yes. They are resolved during the parsing phase. Since TOML doesn't have a concept of pointers or anchors, the data is simply duplicated wherever the alias was used.
What version of YAML and TOML is supported?
It uses js-yaml for YAML 1.2 parsing and smol-toml for TOML 1.0 emission. It covers almost all features of both specs except for YAML features that have no TOML equivalent (like nulls or complex keys).
Why can't I convert a YAML list to TOML?
Because TOML is fundamentally a table (a dictionary). There is no such thing as a TOML file that is just a list. Every piece of data in TOML must belong to a key.
Is my data kept private?
Absolutely. I don't have a backend for this tool. The conversion happens in your browser's JavaScript engine. Your YAML never touches my server — it stays entirely on your machine.
How are comments handled?
Comments are unfortunately lost. Most YAML and TOML parsers treat comments as "trivia" that isn't part of the data model, so when the YAML is parsed into a JavaScript object, the comments disappear before the TOML is even generated.