INI Configuration Parser

INI files are a simple configuration format with sections and key-value pairs, historically used by Windows and still common in many applications (php.ini, my.cnf, setup.cfg). This tool parses INI syntax, displays sections and properties, and can convert to JSON.

Specifications

Common Use Cases

  • Inspect php.ini or MySQL my.cnf configuration
  • Parse Python setup.cfg or tox.ini files
  • Review Git config files (.gitconfig)
  • Debug Windows application settings
  • Convert legacy INI configs to JSON or YAML

Features

  • Parse [section] headers and key=value pairs
  • Handle comments (; and # prefixes)
  • Support quoted values with escape sequences
  • Display global properties (before any section)
  • Convert to JSON for programmatic use
  • Prettified view mode
  • Per-section comment display
  • Parsing warnings for malformed entries

Examples

Database Configuration

Try it →

A typical database configuration file.

[database]
host=localhost
port=3306
name=myapp_db
user=admin

[cache]
enabled=true
ttl=3600
driver=redis

PHP Configuration

Try it →

A snippet from php.ini.

; PHP Configuration
[PHP]
memory_limit = 256M
max_execution_time = 30
upload_max_filesize = 64M

[Date]
date.timezone = "America/New_York"

Tips

  • Section names are case-insensitive in most implementations.
  • Use quotes around values containing special characters.
  • Comments traditionally use ; but some parsers also accept #.
  • Duplicate keys in the same section may overwrite or create arrays depending on the parser.

Understanding INI Configuration

INI files are a simple configuration format using sections (in square brackets) and key-value pairs. Despite having no formal specification, the format has been widely used since the early days of MS-DOS and Windows. PHP uses php.ini, Git uses .gitconfig (INI-style), Windows applications use .ini files, and many legacy systems rely on the format.

The basic structure groups key=value pairs under [section] headers. Values are typically strings, though some parsers interpret numbers and booleans. Comments use semicolons (;) or hash symbols (#). Multi-line values, nested sections, and escape sequences vary between implementations since there is no authoritative standard.

INI files fill the gap between flat key-value formats (like .env files) and structured formats (like TOML and YAML). They provide section-level organization without the complexity of nested data structures. For simple application configuration with logical groupings, INI remains a practical choice.

The lack of standardization is INI's main weakness. Different parsers disagree on comment characters, whether keys are case-sensitive, how to handle duplicate keys and sections, and whether values can span multiple lines. When starting a new project, TOML is generally a better choice as it provides the same section-based organization with a formal specification and richer data types.

TOML was designed as a modern replacement for INI with a formal specification. It adds native data types (integers, floats, booleans, dates, arrays), nested tables, arrays of tables, and multi-line strings — features that INI lacks entirely. For new projects, TOML is the better choice; INI is mainly relevant for legacy compatibility with existing configuration files.

Key case sensitivity varies by implementation. Windows INI functions are case-insensitive, Python's configparser is case-insensitive for keys by default, PHP's parse_ini_file is case-sensitive for keys but case-insensitive for sections, and Git config is case-insensitive for both section and key names. Always check the documentation for your specific parser. Handling special characters in values is similarly inconsistent — some parsers support quoting values with double quotes, some support escape sequences, and some treat everything after the equals sign as a literal value. When special characters are needed, verify the behavior with your specific parser or consider migrating to TOML.

← Back to all tools