What is a .toml file?
Tom's Obvious, Minimal Language · Code and data · Tom Preston-Werner · 2013
TOML is a plain-text configuration file format designed to be obvious to read, using key = value lines under [section] headers instead of YAML's whitespace rules or JSON's brackets. It is the standard config format for Rust's Cargo and modern Python packaging, among many other developer tools.
What is a .toml file used for?
TOML uses key = value lines grouped under [section] headers, aiming to be unambiguous at a glance rather than relying on YAML's significant whitespace or JSON's brackets and quoting.
Every value has an explicit, obvious type, string, number, boolean, date or array, which avoids some of the parsing surprises YAML is known for, such as an unquoted country code being read as something other than text.
It is the standard config format for several major developer tools: Cargo.toml drives every Rust project, pyproject.toml is the modern standard for Python packaging, and it appears in Hugo, Jekyll and many other tools' settings.
Being plain text, you can open, edit and diff a .toml file in any text editor, and most programming languages have a small library that parses it into native data structures.
How to open a .toml file
The .toml format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- VS Code
- Notepad++
- any editor
macOS
- VS Code
- any editor
Linux
- VS Code
- nano
- any editor
Web
- Online TOML validators
How to convert a .toml file
You can convert a .toml file to JSON, YAML using a conversion tool or the export menu of an app that opens it.
.toml file signature (magic bytes)
Programs recognise a .toml file by the bytes at the start of the file, not by its name. These are the signatures for TOML.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | plain text; no fixed signature |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .toml file?
TOML is a plain-text configuration file format designed to be obvious to read, using key = value lines under [section] headers instead of YAML's whitespace rules or JSON's brackets. It is the standard config format for Rust's Cargo and modern Python packaging, among many other developer tools.
Is TOML better than YAML?
Neither is strictly better. TOML trades some of YAML's flexibility for a stricter, more explicit syntax that is harder to get subtly wrong, which is why tools like Cargo for Rust and modern Python packaging chose it.
How do I open a .toml file?
Any plain-text editor works, and most code editors add syntax highlighting for it. Programming languages typically have a small TOML library to load it directly into your code.
Related formats
Sources
Details on this page were checked against authoritative references: