What is an INI file?
INI (Initialization) files are simple text-based configuration files organized into sections with key-value pairs. They were the primary configuration format for Windows applications before the registry and XML/JSON configs became standard. The format was introduced with early versions of Windows and remains widely used today because of its human-readable simplicity.
An INI file groups related settings under named sections enclosed in square brackets. Each setting is expressed as a key=value pair on its own line. Comments begin with a semicolon (;) or hash (#) and are ignored by parsers.
How to open INI files
- Notepad (Windows) — Built-in, no installation required
- Any text editor — Universal support across all platforms
- VS Code (Windows, macOS, Linux) — Syntax highlighting with extensions
- Notepad++ (Windows) — Enhanced editing with syntax coloring
- Vim / Nano (Linux/macOS) — Terminal-based editing
Technical specifications
| Property | Value |
|---|---|
| Format | Plain text |
| Structure | [Section] / key=value |
| Comments | ; semicolon or # hash |
| Encoding | ASCII, UTF-8, UTF-16 |
| Nesting | Not supported (flat structure) |
| Line endings | LF or CRLF |
| File size | Typically < 100 KB |
Common use cases
- Application settings: Desktop application configuration (e.g.,
app.ini,config.ini) - PHP configuration: The
php.inifile controls PHP runtime behavior, memory limits, and extensions - Git configuration:
.gitconfiguses INI syntax for user identity, aliases, and remote URLs - Game settings: Many games store resolution, keybindings, and graphics options in INI files
- Wine emulator: Wine uses
wine.inito configure Windows application compatibility on Linux
INI file structure example
[Database]
host=localhost
port=5432
name=myapp_db
[Server]
host=0.0.0.0
port=8080
debug=false
; API keys — never commit to source control
[Auth]
secret_key=replace_with_real_key
Security considerations
INI files are plain text and should never contain passwords, API keys, or connection strings that are committed to version control. Use environment variables or encrypted secrets managers for sensitive values. If an INI file containing secrets is accidentally committed, rotate the credentials immediately and use git filter-repo to purge the file from history.
Developer tools and parsing libraries
Most programming languages have built-in or popular libraries for reading INI files:
- Python:
configparser(standard library) - PHP:
parse_ini_file()(built-in function) - C#/.NET:
IniFileclass orConfigurationManager - Node.js:
ininpm package - Java:
java.util.Properties(similar key=value syntax)
Limitations and alternatives
INI has no support for nested structures, typed values (everything is a string), or arrays. Modern applications often prefer JSON (.json), YAML (.yaml), or TOML (.toml) for complex configuration needs. However, INI remains the best choice when configuration must be edited by non-technical end users — it requires no knowledge of brackets, quotes, or indentation rules.