INI Validator
Validate INI configuration files such as php.ini, my.cnf, desktop entries or tool settings before a service refuses to start. The validator reads every line, accepts sections, key and value pairs, comments and quoted values, and reports lines it cannot understand, unclosed section headers, empty keys and unclosed quotes. It also flags duplicate keys and sections and lists every section with its keys, so you can review the structure at a glance.
Frequently asked questions
What makes an INI file valid here?
Every non-empty line must be a section header such as [database], a key with a value such as host = localhost, or a comment. A line that is none of these, an unclosed section header, an empty key or an unclosed quoted value is an error. Errors make the file invalid and are listed with their line numbers.
INI has no single standard. Which rules does the validator use?
It follows the common dialect used by PHP, MySQL and many tools: keys and values are separated by = or by : when there is no =, comments start with ; or #, and a ; or # after whitespace in an unquoted value starts an inline comment. Section names may contain spaces, dots and quotes, as in Git style sections. Values are not type checked, because INI has no data types.
What happens with duplicate keys?
A key defined twice in the same section is reported as a warning with the line of the second definition. Most INI parsers keep the last value, so the earlier one is silently ignored. The file is still reported as valid.
What happens with duplicate sections?
A section header that appears again is reported as a warning, and its keys are merged with the keys of the first occurrence. Some programs treat repeated sections differently, so it is usually best to combine them.
Are array keys like extension[] supported?
Yes. Keys ending in [] collect their values into a list, as in PHP configuration files, and repeating them is not reported as a duplicate. The section listing shows the key once.
What are global keys?
Keys that appear before the first section header belong to no section. They are listed as Global keys in the result, and many tools treat them as defaults or top-level settings.
How are quoted values handled?
Values in double quotes may contain ;, # and = and support the escapes \", \\, \n and \t, while values in single quotes are taken literally. A quoted value that is not closed on the same line is an error. Unquoted values are trimmed of surrounding spaces.
How much of the structure is listed?
The result lists every section with its number of keys and the key names, up to 200 sections and 50 keys per section, plus counts of all sections and keys. Up to 20 errors and 20 warnings are shown, with a count of any further ones.
Are nested sections like [a.b] understood?
Section names are kept exactly as written, so [a.b] is a section named a.b and not a subsection of a. Whether a program treats dots as nesting depends on that program. The validator only checks that the name is not empty and the header is closed.
How large can the file be, and can I convert it?
Inputs can be up to 5 MiB. To turn a valid INI file into JSON, YAML, TOML or another format, use the Data Format Converter, which maps sections to objects.