By Mian Ali Khalid · Published · How we build and test tools
How to use the toml to yaml converter
- Paste your TOML document into the input area.
- The YAML output appears as soon as you edit the input.
- Copy the YAML or download it using the button that appears when there is output.
- If the TOML is invalid, an error message explains the problem.
How the TOML to YAML conversion works
The tool parses TOML into an ordered tree using a parser written for the TOML v1.0.0 specification, then writes that tree as block-style YAML with two-space indentation. Parsing and conversion happen in your browser; nothing is sent to a server.
Supported TOML features:
- Basic, literal and multi-line strings, with all TOML 1.0 escapes including
\uXXXXand\UXXXXXXXX - Decimal, hexadecimal, octal and binary integers (kept exact beyond 2^53), floats with underscores,
infandnan, booleans - Offset date-times, local date-times, local dates and local times
- Arrays (including mixed types) and inline tables
- Standard tables, dotted keys, quoted keys and arrays of tables
- Comments (dropped, because YAML conversion does not carry comments over)
For example, title = "Example" becomes title: Example. A table header such as [servers.alpha] becomes a nested mapping: servers: then alpha: then ip: 10.0.0.1, each level indented two spaces further. Key order is preserved, and strings that YAML could read as another type (for example "true", "123" or "null") are written in double quotes so they stay strings.
Common use cases for TOML to YAML
Converting configuration between tools that prefer different formats, for example reading a Cargo.toml or pyproject.toml snippet as YAML, or moving settings into a YAML-based tool.
Developers also use this TOML to YAML converter to inspect TOML structure, because the YAML form can be easier to scan for deeply nested data. Your input stays in the browser tab, so pasting configuration is not an upload, but avoid pasting live secrets into any page you do not need to.
Another common job is migrating TOML configuration to a system that expects YAML. Numbers stay numbers, booleans stay booleans, and arrays become YAML sequences. Check the result against the target tool's schema, since different tools expect different key names.
Reference: TOML to YAML mapping
| TOML | YAML |
|---|---|
key = "value" | key: value |
num = 42 | num: 42 |
arr = [1, 2] | arr:\n - 1\n - 2 |
[table] | table:\n key: val |
[[aot]] | aot:\n - key: val |
inline = { a = 1 } | inline:\n a: 1 |
Edge cases and limitations
YAML conversion does not keep comments, so comments in the TOML input are dropped.
Invalid TOML is rejected with a line number, including cases a lenient parser would accept: duplicate keys, a table defined twice, a key that is both a value and a table, leading zeros in integers, and impossible dates such as 2023-02-30.
Date-times are written as plain YAML timestamps, and local times (07:32:00) are written in quotes because some YAML parsers read an unquoted time as a number. Whether a date becomes a date object or a string depends on the YAML parser you load the output with.
Input is limited to 1 MB and 100 levels of nesting. Features that arrived only in TOML 1.1, such as the \e and \xHH escapes and multi-line inline tables, are reported as errors.
If a value is missing after an equals sign (for example bad =), the converter reports an error instead of producing empty output.
Worked examples
| Example | Input | Result |
|---|---|---|
| Simple config | TOML input: title = "TOML Example" / [owner] / name = "Tom Preston-Werner" / dob = 1979-05-27T07:32:00-08:00 / [database] / server = "192.168.1.1" / ports = [8001, 8002, 8003] / connection_max = 5000 / enabled = true | title: TOML Example / owner: / name: Tom Preston-Werner / dob: 1979-05-27T07:32:00-08:00 / database: / server: "192.168.1.1" / ports: / - 8001 / - 8002 / - 8003 / connection_max: 5000 / enabled: true |
| Array of tables | TOML input: [[products]] / name = "Hammer" / sku = 738594937 / [[products]] / name = "Nail" / sku = 284758393 / color = "gray" | products: / - name: Hammer / sku: 738594937 / - name: Nail / sku: 284758393 / color: gray |
| Inline table and multiline string | TOML input: name = "Test" / point = { x = 1, y = 2 } / str = """ / Roses are red / Violets are blue / """ | name: Test / point: / x: 1 / "y": 2 / str: "Roses are red\nViolets are blue\n" |
| Nested tables | TOML input: [servers.alpha] / ip = "10.0.0.1" / role = "web" / [servers.beta] / ip = "10.0.0.2" / role = "db" | servers: / alpha: / ip: "10.0.0.1" / role: web / beta: / ip: "10.0.0.2" / role: db |
FAQ
Does this tool send my data to a server?
No. All parsing and conversion happen in your browser. Your TOML never leaves your machine.
Which TOML version is supported?
The parser implements TOML v1.0.0 (the current stable specification).
Why are my comments missing in the output?
YAML has no standardized comment preservation across libraries. This tool drops comments to produce clean, valid YAML.
Can I convert very large TOML files?
Input up to 1 MB is accepted. Typical configuration files convert in a few milliseconds.
What happens with duplicate keys?
Duplicate keys are an error in TOML, so the converter reports the line instead of picking one. The same applies to defining the same table twice.
Are there any TOML features not supported?
It implements TOML 1.0.0 in full. Syntax that only exists in TOML 1.1 (the \e and \xHH escapes, newlines inside inline tables, optional seconds in times) is rejected.
How does this TOML to YAML converter handle dotted keys?
Dotted keys like a.b.c = 1 and table headers like [servers.alpha] are both parsed into nested tables, so a.b.c = 1 produces a:, then b: indented under it, then c: 1 indented under that.
Does it keep my numbers exact?
Integers are parsed as arbitrary-size integers, so values such as 9223372036854775807 keep every digit. Floats are written with a decimal point or exponent so YAML reads them as floats, and inf and nan become .inf and .nan.
Why are some strings in quotes?
Plain YAML would turn words like true, no, null or 123 into booleans, null or numbers, and would break on text containing a colon or hash. The converter quotes any string that is not plainly safe so the data round-trips unchanged.