TOML Formatter & Converter

Format, minify, and convert TOML data online. Bidirectional TOML-JSON conversion. Free, private, runs entirely in your browser.

Your data never leaves your browser

Enter TOML or JSON and click an action button above

How to Use

  1. Paste your TOML or JSON into the input textarea on the left.
  2. Click Format to beautify your TOML with proper indentation and spacing.
  3. Click Minify to remove comments and extra whitespace for a compact output.
  4. Use TOML to JSON or JSON to TOML for format conversion.
  5. Click Copy to copy the result to your clipboard.

What Is TOML?

TOML stands for Tom's Obvious Minimal Language. Created by Tom Preston-Werner (co-founder of GitHub), TOML is a configuration file format that aims to be easy to read due to its clear semantics. Unlike many other configuration formats, TOML is designed to map unambiguously to a hash table, meaning there is exactly one way to interpret any valid TOML document.

TOML was first released in 2013 and reached its stable 1.0 specification in January 2021. The format has gained significant adoption across the software ecosystem, particularly in the Rust and Python communities. Rust's package manager Cargo uses Cargo.toml as its manifest file, Python's packaging ecosystem adopted pyproject.toml as the standard build configuration file (PEP 518), and Hugo, one of the most popular static site generators, uses TOML as its primary configuration format.

TOML Syntax Overview

TOML files are organized around key-value pairs, tables (sections), and arrays. Here is a quick overview of the core syntax elements:

  • Key-Value Pairs — The fundamental building block. Keys are on the left of an equals sign, values on the right: name = "CodeTidy"
  • Strings — Basic strings use double quotes with escape sequences ("hello\nworld"). Literal strings use single quotes with no escaping ('C:\path\to\file'). Multi-line variants use triple quotes.
  • Numbers — Integers (42), floats (3.14), hex (0xDEADBEEF), octal (0o755), and binary (0b11010110) are all supported.
  • Booleans — Lowercase only: true and false.
  • Dates — First-class support for RFC 3339 dates: 2026-03-09T12:00:00Z.
  • Tables — Sections defined with square brackets: [database]. Nested tables use dotted keys: [server.production].
  • Arrays — Square bracket values: ports = [8001, 8002, 8003].
  • Array of Tables — Double brackets create arrays of table entries: [[products]].
  • Inline Tables — Compact table syntax on a single line: point = { x = 1, y = 2 }.
  • Comments — Hash symbol to end of line: # This is a comment.

TOML vs YAML vs JSON

Choosing between TOML, YAML, and JSON depends on your use case. Each format has distinct strengths and weaknesses for configuration management:

TOML excels at configuration files. Its syntax is unambiguous — there is no implicit type coercion (unlike YAML where no becomes a boolean), indentation is not significant (eliminating an entire class of whitespace bugs), and comments are a first-class feature. TOML natively supports dates and times, which JSON lacks entirely. The main limitation is that TOML becomes unwieldy for deeply nested data structures, as table headers grow long.

YAML is more expressive and handles deeply nested structures elegantly through indentation. It supports complex features like anchors, aliases, and multi-document streams. However, YAML's flexibility is also its weakness: the "Norway problem" (country code NO being parsed as boolean false), significant whitespace causing subtle bugs, and multiple ways to express the same data make it error-prone. YAML 1.2 addressed some of these issues, but many parsers still implement YAML 1.1.

JSON is the universal data interchange format. Every programming language has native or near-native JSON support. It is ideal for APIs and data serialization but poor for configuration: no comments, no trailing commas, verbose syntax, and no date type. JSON5 and JSONC (JSON with Comments) address some of these issues but are not universally supported.

As a general rule: use TOML for configuration files, YAML for complex structured data that humans need to read, and JSON for data interchange between systems. This tool helps you convert between TOML and JSON when you need to bridge the gap.

Common TOML Use Cases

  • Rust / Cargo — Every Rust project has a Cargo.toml manifest defining dependencies, metadata, and build configuration.
  • Python / pyproject.toml — The modern standard for Python project configuration, replacing setup.py and setup.cfg.
  • Hugo — Static site generator that uses config.toml for site-wide settings.
  • Deno — JavaScript/TypeScript runtime using deno.toml for project configuration.
  • GitHub Actions — Some CI/CD configurations use TOML for tool-specific settings like rustfmt.toml and clippy.toml.
  • Starship — The popular cross-shell prompt uses starship.toml for customization.
  • Pipenv — Python packaging tool using Pipfile which follows TOML syntax.

TOML Formatting Best Practices

When writing TOML configuration files, following consistent formatting conventions improves readability and maintainability:

  • Use spaces around the equals sign: key = "value" not key="value".
  • Group related keys under the same table header.
  • Add blank lines between table sections for visual separation.
  • Use comments to explain non-obvious configuration values.
  • Prefer bare keys when possible; only quote keys that contain special characters.
  • Use multi-line arrays for lists with more than 3-4 items.
  • Keep inline tables short; use standard tables for anything beyond a few keys.

Related Tools

Convert between JSON and YAML with the JSON-YAML Converter. Format JSON data with the JSON Formatter. Validate JSON syntax with the JSON Validator. Format XML configuration files with the XML Formatter. Compare configuration file changes with the Diff Checker. Format SQL queries embedded in config with the SQL Formatter.

Learn More

Frequently Asked Questions

What is TOML?
TOML (Tom's Obvious Minimal Language) is a configuration file format designed to be easy to read and write. It maps unambiguously to a hash table and is used in many tools including Rust's Cargo, Python's pyproject.toml, and Hugo static site generator.
How is TOML different from YAML and JSON?
TOML is designed specifically for configuration files with a clear, unambiguous syntax. Unlike YAML, indentation is not significant and there are no gotchas with implicit type coercion. Unlike JSON, TOML supports comments, dates, and is more human-readable for configuration use cases.
Can I convert between TOML and JSON?
Yes. This tool supports bidirectional conversion. Click "TOML to JSON" to parse TOML and output JSON, or "JSON to TOML" to convert a JSON object into TOML format. The JSON root must be an object (not an array or primitive).
Does this tool send my data to a server?
No. All parsing, formatting, and conversion happens entirely in your browser using JavaScript. No data is transmitted to any server — your configuration files stay private.
What TOML features are supported?
This tool supports the full TOML 1.0 specification: key-value pairs, tables, nested tables, array of tables, inline tables, arrays, strings (basic, literal, and multi-line), integers (decimal, hex, octal, binary), floats, booleans, and RFC 3339 dates. Comments are stripped during formatting and minification since the tool parses and re-serializes the data structure.
Can I customize the formatting?
Yes. Use the Indent dropdown to choose between 2 or 4 spaces per level, and enable "Sort keys" to alphabetically order keys within each table. These options apply to both Format and JSON to TOML modes.

Code Examples

Learn how to use this tool programmatically in your favorite language.

AI agent tools available. The CodeTidy MCP Server gives Claude, Cursor, and other AI agents access to 47 developer tools. One command: npx @codetidy/mcp

Drop file to load