⭐ 0

TOML Validator

Check TOML-like lines for section headers, key = value pairs, duplicates, and simple quotes and brackets.

🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.

The result appears on this page after you run the tool. Nothing you enter is uploaded.

Processing... 0%
Parsing TOML tables
Verifying variables
Checking array blocks
Checking duplicate headers
Compiling variables

Result

About this tool

The scanner reads one trimmed line at a time. It is not a TOML library. A blank line, or a line that starts with # or ;, is skipped. A line that matches one or more opening brackets, some text, and one or more closing brackets is treated as a header. The name inside is trimmed and must not be empty. A normal [section] whose name was already seen fails with Duplicate TOML section header. A line that starts with [[ is allowed to repeat, so an array-of-tables header can appear twice. Starting any header clears the set of keys, which means a new header, including a repeated [[name]], starts a fresh key set.

A line that is not a header must contain an equals sign. The key is everything before the first equals, trimmed. An empty key fails. The key must match letters, digits, underscore, hyphen, dot, space, or quotes. A dotted key such as a.b is accepted as one key string. It is not turned into a nested table. The same key string twice before the next header fails with Duplicate key. The value is only lightly checked. A value that starts with a double quote and does not end with one fails, unless it both starts and ends with three double quotes. The same idea applies to single quotes and triple single quotes. A value that starts with [ and does not end with ] has its brackets counted, and unequal counts fail as mismatched brackets. The count is for that line only.

Anything that is not a header and has no equals sign fails as invalid TOML syntax, and the message quotes the line. The success text is TOML syntax is valid! A passing file can still be illegal TOML. The scanner does not parse inline tables, does not join a multiline basic string that is not a single triple-quoted token, does not understand dates as a type, and does not apply the rule that a value and a table cannot share a name. A semicolon comment is accepted here even though standard TOML comments are #. That is this scanner being looser than the spec, not a promise that a TOML parser will accept the semicolon. Failures name the line and the page reprints two lines of context around it. The text stays in the browser and can be copied or downloaded. Use the result to catch a missing equals sign, a repeated key, or a quote that never closes. Use a real TOML parser before you ship a Cargo.toml or a config that uses dotted keys, arrays of tables with inline tables, or multiline strings.

Example. [server]\nport = 8080 passes. A second [server] fails with Duplicate TOML section header. A second [[products]] is allowed. port = 1 and another port = 2 in the same section fail with Duplicate key "port".

Limit. The check is line-oriented. Dotted keys are not nested, multiline values must fit the one-line quote test, and a semicolon is treated as a comment even though standard TOML comments start with #.

What is accepted as a TOML header?

A trimmed line like [server] or [[products]]. The name inside cannot be empty. A repeated [server] fails. A repeated [[products]] is allowed, and each header clears the key set so the same key can appear in the next table.

Are dotted keys nested?

No. a.b = 1 is stored as the single key text a.b. The scanner does not build a table called a. It also does not parse inline tables or a value that spans several lines, except for the special case of a value that itself starts and ends with triple quotes on that same line.

Which comments work?

A whole line that starts with # or with ; is skipped. Standard TOML only uses #. A semicolon here is this scanner being permissive. A comment at the end of a value is not stripped, because only a line that starts with the mark is special.

Does a pass mean Cargo.toml is valid?

It means this line scanner found headers and key = value rows it accepts. Types, mixed table kinds, and multiline strings are not enforced the way a TOML parser enforces them. Download or copy the report, then run a real parser on the file you intend to ship.