
Download free sample TOML files instantly — Cargo.toml, pyproject.toml, Hugo config, GitHub Actions, app configs, and more. Valid TOML v1.0, generated entirely in your browser. TOML files open in any text editor like Notepad, Notepad++, Sublime Text, etc.
Tool-specific TOML — correct field names, types, and structure for each ecosystem
Generic config patterns — app config, data tables, multi-environment, and feature flags
Parser conformance — every TOML data type, inline tables, arrays of tables, and edge values
Configure template, comments, and formatting options
| Feature | TOML | YAML | INI |
|---|---|---|---|
| Type system | ✓ Explicit (string, int, float, bool, datetime, array, table) | Implicit (inferred from value) | Strings only |
| Datetime support | ✓ Native RFC 3339 | Partial (context-dependent) | ✗ |
| Multi-line strings | ✓ """...""" and '''...''' | ✓ | and > | ✗ |
| Arrays of tables | ✓ [[table]] syntax | Use list of maps | ✗ |
| Ambiguity risk | Low — explicit types | High — yes/no are booleans in 1.1 | Medium |
| Comment syntax | # | # | # or ; |
| Primary use case | Package manifests, structured app config | CI/CD, Kubernetes, complex data | Simple app settings |
| Learning curve | Low — reads like INI, has YAML power | Medium — whitespace-significant | Very low |
What is TOML and where is it used?
TOML (Tom's Obvious, Minimal Language) is a configuration file format designed to be easy to read and write, with an explicit type system that eliminates the ambiguity common in YAML and INI files. It was created by Tom Preston-Werner (co-founder of GitHub) in 2013.
TOML is used widely across the developer ecosystem: Rust's Cargo package manager uses Cargo.toml as its package manifest; Python's modern packaging standard (PEP 517/518/621) uses pyproject.toml; the Hugo and Zola static site generators use TOML for site configuration; and tools like Ruff, Taplo, and Lefthook use TOML for their configs. It is also common in Go projects, Deno, and many CLI tools.
What is the difference between TOML and YAML?
The most practical difference is type handling. TOML has an explicit type system — you can always tell exactly what type a value is from its syntax: 42 is an integer, 3.14 is a float, "hello" is a string, true is a boolean, 2024-01-15 is a date. YAML infers types from context, which causes notorious bugs — in YAML 1.1, yes, no, on, and off are parsed as booleans, and 1.10 becomes the float 1.1.
TOML also requires explicit section markers ([section]) rather than using significant whitespace, which means indentation errors never silently corrupt the structure. The tradeoff is that TOML is less compact than YAML for deeply nested structures. Most developers find TOML preferable for configuration files and YAML preferable for CI/CD pipelines and Kubernetes manifests.
What is an array of tables in TOML?
An array of tables is TOML's syntax for a list of structured objects. While a regular table is defined with [section], an array of tables uses double brackets: [[section]]. Each [[section]] header creates a new entry in the array. For example, in a Cargo.toml you might have multiple [[bin]] entries to define multiple binary targets, or in a Hugo config multiple [[menu.main]] entries to define navigation items. This is equivalent to a YAML list of maps but with more explicit syntax.
How do I read a TOML file in Python?
Python 3.11+ includes tomllib in the standard library: import tomllib; with open('config.toml', 'rb') as f: config = tomllib.load(f). Note that tomllib opens the file in binary mode ('rb'), not text mode. For Python 3.10 and earlier, install tomli: pip install tomli — it has an identical API. For writing TOML (which tomllib doesn't support), use tomli-w: pip install tomli-w; import tomli_w; tomli_w.dumps(data). The tomlkit package supports both reading and writing while preserving comments and formatting.
How do I read a TOML file in Rust?
Add the toml crate to your Cargo.toml dependencies: toml = "0.8". For deserialization into a struct, also add serde = { version = "1", features = ["derive"] }. Then: let content = std::fs::read_to_string("config.toml")?; let config: MyConfig = toml::from_str(&content)?; where MyConfig is a struct derived with #[derive(serde::Deserialize)]. For untyped access, deserialize into toml::Value instead. The config crate is also popular for layered configuration that merges TOML files with environment variables and defaults.
What is pyproject.toml and why did Python switch to it?
pyproject.toml is the modern standard configuration file for Python projects, introduced through a series of PEPs (517, 518, 621). It replaces the older setup.py, setup.cfg, and requirements.txt files with a single, standardized location for all project metadata. The [build-system] table specifies which build backend to use (setuptools, hatch, flit, poetry, etc.). The [project] table contains package metadata. Tool-specific configuration goes in [tool.toolname] sections — so [tool.pytest.ini_options], [tool.ruff], [tool.mypy] all live in the same file. Most modern Python tools (Black, Ruff, Mypy, pytest, coverage.py) read their configuration from pyproject.toml.
What are inline tables in TOML?
Inline tables are a compact single-line syntax for small tables: point = { x = 1, y = 2 }. They are equivalent to a regular table section but written on one line. Inline tables must be complete — you cannot add keys to them later in the file, unlike regular tables which can be extended. They are useful for values that are conceptually a unit (like a coordinate, an RGB color, or a simple record) but would be verbose to write as a full section. In Cargo.toml, inline tables are commonly used for dependency specifications: serde = { version = "1", features = ["derive"] }.
