Ffile2fix
Sign in Get started

What is a .toml file?

TOML (Tom's Obvious, Minimal Language) is a human-readable configuration format with INI-like [sections] and strict, typed values. You meet it as pyproject.toml in Python projects, Cargo.toml in Rust, and in config for Hugo, Netlify, Cloudflare Wrangler and many CLI tools.

Key facts

  • Plain UTF-8 text; the current stable specification is TOML 1.0.0 (2021).
  • Values are typed: strings must be quoted, and integers, floats, booleans, dates/times, arrays and tables are distinct types.
  • [table] headers create sections, [[array.of.tables]] creates lists of tables, and dotted keys (a.b = 1) create nested tables.
  • MIME type application/toml; files are usually a few hundred bytes to a few KB.

How to open a .toml file

Windows

Open it in VS Code (add the Even Better TOML extension for validation) or Notepad++. Notepad works for quick edits.

macOS

Edit in VS Code, BBEdit or any text editor. With Python 3.11+, validate it in Terminal: python3 -c "import tomllib,sys; tomllib.load(open(sys.argv[1],'rb'))" pyproject.toml.

Linux

Edit with nano, vim or VS Code, and validate with the same python3 tomllib one-liner; no output means the file parsed successfully.

Common problems and fixes

Duplicate key or 'table defined more than once' error
TOML forbids defining the same key or [table] twice. Merge the duplicate sections into one, and check dotted keys are not redefining an existing table.
Invalid value / expected a string
Unlike INI, unquoted text is not a string in TOML. Wrap text in double quotes (name = "app") and use true/false in lower case for booleans.
Inline table spans several lines and fails to parse
TOML 1.0 requires inline tables { ... } to stay on one line with no trailing comma. Rewrite them as a normal [table] section if they are long.
Tool ignores my settings
The keys are under the wrong table, e.g. [tool.black] in pyproject.toml or [dependencies] in Cargo.toml. Check the tool's documentation for the exact section name.

Often converted to or from: JSON, YAML, INI, requirements.txt (dependencies)

Frequently asked questions

Is TOML the same as INI?

It looks similar but is stricter and fully specified: strings must be quoted, values have types and nested tables and arrays are supported. Many INI files are not valid TOML.

TOML vs YAML: which should I use?

TOML is easier to get right for flat or moderately nested config because indentation does not matter. YAML is more compact for deeply nested data but has more surprising parsing rules.

Can TOML files have comments?

Yes. Anything after a # outside a string is a comment, which is one reason TOML is preferred over JSON for hand-edited configuration.

See all file types → · Browse error fixes →