Format TOML

Normalize TOML tables, values, and arrays into consistent output.

freeworks offlinenothing uploaded
ToolTOML Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The document is parsed into TOML values, tables, arrays, and inline tables, then serialized with normalized spacing and indentation. Data types survive parsing but comments and original layout do not.

  • TOML 1.0 is the language baseline.
  • Canonical serialization makes output deterministic.

Worked example

Normalize messy Cargo.toml
Clean up a Cargo.toml with compact inline tables. The formatter expands them into proper sections
Input
											[package]
name="my-app"
version="0.1.0"
edition="2021"

[dependencies]
serde={version="1.0",features=["derive"]}
tokio={version="1",features=["full"]}
										
Output
												[package]
name = "my-app"
version = "0.1.0"
edition = "2021"

[dependencies.serde]
version = "1.0"
features = [ "derive" ]

[dependencies.tokio]
version = "1"
features = [ "full" ]

											

When to use this

Cargo.toml, pyproject.toml, and CLI configuration files use normalized TOML.

Edge cases

  • A bare date remains a TOML date value rather than a string.
  • Duplicate keys are invalid even when a later value seems intended to override.
  • Comments disappear because they are not data values.

References