📖 What is a TOML File?
A TOML file is a configuration file. It uses the .toml extension, and it stores settings for a program in a layout designed above all to be easy for a person to read and write.
The name stands for Tom's Obvious Minimal Language, after its creator Tom Preston-Werner, a co-founder of GitHub, who released it in 2013. The word obvious sums up the aim, since a TOML file is meant to make sense at a glance, without you having to learn the format first.
In practice a TOML file looks a lot like an old INI file with the rough edges smoothed off. Settings are written as a name, an equals sign and a value, grouped under headings in square brackets. That plain shape is why so many developer tools have adopted it for their settings.
Key Characteristics
- A config file, in plain readable text
- Obvious by design, clear at a glance
- Name equals value, grouped in tables
- Strong value types, with no guessing
Good to Know
- Made by Tom Preston-Werner, in 2013
- Looks like an INI file, but specified
- Allows comments, with a hash mark
- Used by Cargo and Python, among others
⚡ Quick Facts
| File Extension | .toml |
| Full Name | Tom's Obvious Minimal Language |
| Category | Configuration file |
| Created By | Tom Preston-Werner |
| First Released | 2013 |
| Format | Plain text |
| MIME Type | application/toml |
| Comments | Yes, with a hash mark |
| Related Extensions | .yaml, .json, .ini |
🔍 What Is Inside
Open a .toml file in an editor and it reads almost like a labelled list. Here a few settings sit at the top, and a heading in brackets starts a group of related ones.
A small piece of TOML
# a project's settings title = "My App" [owner] name = "Ada" active = true [server] port = 8080 hosts = [ "alpha", "beta" ]
Each line pairs a name with a value using an equals sign. The bracketed [owner] and [server] lines are tables, headings that group the settings beneath them. Notice how each value already shows its kind. Text sits in quotes, true is a yes or no, 8080 is a number, and the square brackets hold a list.
✍️ The Syntax
TOML keeps its rules few and plain. These are the building blocks you meet in almost every file.
Key and Value
Every setting is a name, an equals sign and a value, one per line and simple to scan.
Tables
A heading in square brackets groups related settings, like a section title in a document.
Nested Tables
Dotted headings such as server.alpha let you build settings inside other settings.
Comments
A hash mark starts a note, whole-line or after a value, that the parser ignores.
Arrays
Square brackets hold a list of values, handy for things like ports or tags.
Dates
TOML understands dates and times on their own, written plainly right in the file.
A couple more touches round it out. Related settings can also be written on one line as an inline table wrapped in curly braces, handy for small groups, and every TOML file is saved as UTF-8 text, so accented letters and other characters are safe to use.
🎯 Strong Types
One thing that sets TOML apart is how firmly it treats the kind of each value. A number is always a number, and a piece of text is always text.
This matters because it removes guesswork. In some formats a bare word or a value like yes can be read as text one moment and a yes-or-no the next, which leads to puzzling bugs. TOML avoids that by giving each value a clear kind, decided by how you write it. Quotes make text, plain digits make a number, true or false make a yes-or-no, and a plain date makes a date. Nothing is silently turned into something else.
🔤 Kinds of Text
Text is the value you write most, and TOML gives you a few ways to write it, each suited to a different job.
The three ways to write text
# basic string, double quotes, escapes allowed greeting = "Hello\tworld" # literal string, single quotes, no escaping path = 'C:\Users\ada' # multi-line string, triple quotes note = """line one line two"""
A basic string uses double quotes and lets you write escape codes, so \t becomes a tab. A literal string uses single quotes and takes every character exactly as typed, which is ideal for Windows paths or a regular expression where backslashes should stay put. And a multi-line string uses three quotes so the text can run across several lines. Picking the right one keeps a value saying exactly what you mean.
⚖️ TOML vs YAML vs JSON
TOML is one of three formats you often see for settings and data. Each has a place, and the differences are easy to sum up.
| Point | TOML | YAML | JSON |
|---|---|---|---|
| Built for | Config | Config | Data exchange |
| Comments | ✓ | ✓ | ✗ |
| Needs indenting | ✗ no | ✓ yes | ✗ no |
| Easy by hand | ✓ very | ~ tricky | ~ fiddly |
Against JSON, the big win is that TOML lets you write comments and does not drown you in brackets and quotes, which makes it far kinder for settings a person edits. Against YAML, the win is that TOML does not lean on indentation to show structure, so a stray space cannot quietly change the meaning. JSON still rules for data sent between programs, while YAML and TOML compete for hand-written config, with TOML favouring plainness and firm rules.
🧰 Where TOML Is Used
You meet TOML most in the settings files of developer tools. A few well-known ones have made it their standard.
Cargo.toml | The settings file for Rust projects, listing a package and what it depends on. |
pyproject.toml | The modern settings file for Python packages, describing how a project is built. |
| Hugo | The Hugo website builder uses TOML for a site's configuration. |
| Many tools | Linters, formatters and other developer tools keep their options in a .toml. |
📂 How to Open a TOML File
Because a .toml is plain text, opening one is easy, and you likely already have a tool that does it. The right choice depends on what you want to do with it.
A quick preview
Univik's File Viewer shows the contents of a .toml in your browser, with nothing to install.
An editor
VS Code or Sublime add colouring that makes the tables and values stand out clearly.
A program
Code reads a .toml through a library, such as Python's built-in tomllib, turning it into data.
One thing is worth knowing about that last route. Python's tomllib only reads TOML, it does not write it. To create or update a .toml from code you reach for a separate library, such as tomli-w for writing or tomlkit, which can edit an existing file while keeping its comments and layout intact.
🔄 Converting TOML
Since TOML, YAML and JSON all describe the same sort of structured data, moving between them is a common need, whether to fit a tool that expects a different format or to compare two.
Because every TOML file maps cleanly onto a plain data structure, it turns into JSON or YAML without losing anything. Univik's File Converter handles this in the browser, so you can take a .toml and get back the same settings as JSON, or the reverse, without installing a toolchain. That is handy when a project standardises on one format but you have a file in another.
🛠️ Common Issues
A .toml opens in any editor without trouble, so problems usually appear when a program tries to read it and the syntax is slightly off.
| Parse error | A tool rejects the file. A missing quote, bracket or equals sign is the usual cause, and the message names the line. |
| Wrong value kind | A number written in quotes becomes text, or the reverse. Match how you write a value to the kind you mean. |
| Duplicate key | The same name set twice in one table is not allowed. Rename or remove the repeat to clear it. |
| Wrong file expected | A tool wants its own name, such as pyproject.toml. Check the filename the tool looks for. |
🔀 Related Formats
A .toml sits alongside the other text formats used for settings and structured data.
.yaml | Another readable config format, structured by indentation, richer but easier to trip over. |
.json | The standard for data sent between programs, strict and bracket-heavy, with no comments. |
.ini | The old settings format TOML resembles, simpler but without a formal standard or nesting. |
.cfg | A general settings file whose exact rules depend on the program that reads it. |
.lock | A companion file some tools generate, such as Cargo.lock, pinning exact versions. |
❓ Frequently Asked Questions
A TOML file is plain text, so almost anything opens it. For a quick look without installing software, Univik's File Viewer shows the contents in your browser. To edit it, a code editor like VS Code or Sublime adds colouring that makes the tables and values easy to read. And a program reads a .toml through a library, such as Python's built-in tomllib, turning the settings into data it can use. There is no special TOML-only application you need.
A TOML file is a configuration file, using the .toml extension, written in Tom's Obvious Minimal Language. It stores a program's settings in a layout built to be read and edited by hand with as little confusion as possible. Created by Tom Preston-Werner in 2013, it pairs a name with a value using an equals sign and groups settings under headings in square brackets, looking much like a tidied-up INI file. Many developer tools use it for their configuration.
TOML stands for Tom's Obvious Minimal Language. It is named after its creator, Tom Preston-Werner, a co-founder of GitHub, who released it in 2013. The word obvious captures the goal, a configuration file you can read and understand at a glance without first studying the format. Minimal captures the other half, keeping the rules few so the format stays simple. The name is a fair summary of what the format sets out to be.
Both are readable configuration formats that allow comments, but they structure data differently. YAML uses indentation to show nesting, which is compact but means a stray space can quietly change the meaning. TOML uses headings in square brackets instead, so structure does not depend on whitespace, which cuts a whole class of mistakes. TOML also fixes each value's kind firmly, while YAML sometimes guesses, so many people find TOML more predictable for hand-written settings.
JSON is built for data passed between programs, while TOML is built for settings a person writes. The clearest practical differences are that TOML allows comments and JSON does not, and that TOML avoids JSON's heavy brackets and quoting, so it is far easier to edit by hand. JSON remains the better choice when software is generating and reading the data, but for configuration files that people maintain, TOML is the friendlier of the two.
Many developer tools do. Rust's Cargo uses a Cargo.toml to describe a project and its dependencies, and modern Python packaging uses pyproject.toml to say how a project is built. The Hugo website builder keeps its site configuration in TOML, and a long list of linters, formatters and other tools store their options in a .toml. Its plain, predictable layout is a large part of why so many command-line and developer tools have adopted it.
Yes. Because a TOML file maps cleanly onto a plain data structure, it turns into JSON without losing information, and Univik's File Converter does this in the browser. The same works in reverse for most files, though a few shapes that JSON or YAML allow do not fit TOML's rules, so a conversion back into TOML may flag those for you to adjust. Converting is useful when a tool expects one format but your file is in another.
They look similar and are often compared, but TOML is the more capable of the two. Both use headings and name-equals-value lines, which is why anyone who has edited an INI file finds TOML familiar. The difference is that INI has no single agreed standard and cannot express nested data or firm value kinds, while TOML has a formal specification, supports nested tables and gives every value a clear type. TOML is, in effect, INI grown up.
Yes, and it is one of the reasons people choose it. A hash mark begins a comment, which can fill a whole line or sit after a value on the same line, and the parser ignores everything from the hash to the end of the line. This lets you explain what a setting does or why a value was chosen, right next to it. The lack of comments in JSON is a common reason developers prefer TOML for configuration.
It is a TOML configuration file at the root of a Python project, and it is the modern standard for describing how that project is built and packaged. It lists things like the project's name, version and dependencies, and which build tool to use, in place of older separate config files. Because Python can read TOML with its built-in tomllib module, tools across the Python ecosystem now look for pyproject.toml, which is why you often see .toml files in Python projects.
Almost always because of a small syntax slip that stops a program parsing it. A missing quote, bracket or equals sign is the usual culprit, and the error message normally points to the line. Writing a value in the wrong form is another common cause, such as putting a number in quotes so it is read as text. Setting the same name twice in one table also fails. Fixing the flagged line and matching each value to the kind you intend usually clears it.
Python's built-in tomllib reads TOML but cannot write it, so for creating or updating a file you use a separate library. The tomli-w package writes a data structure out as TOML, and tomlkit goes further by editing an existing .toml while preserving its comments and layout, which makes it the better choice when you want to change one value without reformatting the whole file. For simply reading settings, tomllib on its own is enough.
TOML has three ways to write text. A basic string uses double quotes and allows escape codes, so it handles things like tabs and Unicode. A literal string uses single quotes and takes every character exactly as written, with no escaping, which suits Windows file paths and regular expressions where backslashes should stay. A multi-line string uses triple quotes and can run across several lines. Choosing the right one lets a value hold exactly the text you mean.
The surest way is to parse it. If a TOML parser reads the file without raising an error, the file is valid, so running it through a tool like Python's tomllib or an online TOML validator confirms the syntax. An editor with TOML support also flags mistakes as you type. Common things a validator catches are a missing quote or bracket, a value written in the wrong form, and the same key set twice in one table.
📝 Summary
A TOML file is a configuration file, using the .toml extension, written in Tom's Obvious Minimal Language, a format created by Tom Preston-Werner in 2013 to be read and edited by hand with as little confusion as possible. Settings are written as a name, an equals sign and a value, grouped under headings in square brackets called tables, with dotted headings for nesting and a hash mark for comments, so a .toml looks much like a tidied-up INI file. Its values carry firm types decided by how they are written, so text, numbers, yes-or-no values and dates are never mixed up. Against JSON it adds comments and drops the heavy brackets, and against YAML it avoids indentation-based structure, which is why so many developer tools, including Rust's Cargo and Python's pyproject.toml, use it for configuration. You open a .toml in any text editor or with Univik's File Viewer in the browser, programs read it through libraries like Python's tomllib, and because it maps cleanly onto plain data it converts to and from JSON or YAML with Univik's File Converter.