TOML Validator
Validate TOML files such as Cargo.toml, pyproject.toml or Hugo and Netlify settings before a build fails on them. The validator parses the input against the TOML specification and reports the first error with its line, column and the parser's explanation, including duplicate keys, redefined tables and impossible dates. Valid files show the number of tables and keys and the top-level keys, so you can confirm the structure at a glance.
Frequently asked questions
What does the TOML validator check?
It parses keys, strings, numbers, booleans, dates and times, arrays, inline tables, tables and arrays of tables exactly as the TOML specification defines them. Any deviation, such as a missing value, an unquoted string or a bad escape, is reported as an error. Valid files get a short summary of their structure.
What information does an error contain?
Each error shows the line and column where parsing stopped and a details line from the parser, for example invalid date or trying to redefine an already defined table or value. Lines and columns start at 1. Only the first error is shown, because later errors often follow from it.
Why is a key or table reported as redefined?
TOML does not allow the same key twice in a table, and a table header such as [server] may appear only once. Defining a dotted key like server.port after a [server] table that already set port also counts as a redefinition. Merge the entries into one place to fix it.
How are tables and keys counted?
Tables counts every table below the root, including inline tables and each entry of an array of tables. Keys counts every key that holds a value other than a table or an array of tables, so a list of strings counts as one key. Top-level keys lists the names at the root, up to 50 of them.
Are dates and times checked?
Yes. Offset date-times, local date-times, local dates and local times are all validated, including impossible values such as month 13 or hour 25. A date written in another format, for example 05/27/1979, is not a TOML date and must be quoted as a string.
Which strings and escapes are allowed?
Basic strings in double quotes support escapes such as \n, \t, \" and \uXXXX, while literal strings in single quotes take every character as written. Both have multi-line forms with three quotes. An unknown escape or an unterminated string is reported with its position.
Are very large integers accepted?
Yes. Integers up to the 64-bit limit of the TOML specification, such as 9223372036854775807, are accepted. Integers beyond that range, leading zeros and underscores that are not between digits are errors.
Does a byte order mark or Windows line ending cause problems?
No. A UTF-8 byte order mark at the start is ignored, and both LF and CRLF line endings are accepted. Control characters inside strings that are not escaped are reported as errors.
Does it check the meaning of keys, like Cargo or Poetry would?
No, the validator checks TOML syntax and structure only. A file can be valid TOML and still contain a key that Cargo or a Python build backend does not understand. Use the tool to rule out syntax problems before looking at tool-specific settings.
How large can the input be, and can I convert it?
Inputs can be up to 5 MiB and nested arrays and inline tables up to 64 levels deep. To turn valid TOML into JSON, YAML or another format, use the Data Format Converter.