How to Make an INI File: A Complete Guide to Creating and Formatting Configuration Files

INI files are one of the oldest and most straightforward ways to store configuration data for software applications. Despite their age, they remain widely used across Windows utilities, game engines, legacy software, and custom scripts. If you need to create one — whether from scratch or to customize an existing application — the process is simpler than it looks, but the details matter.

What Is an INI File?

An INI file (short for initialization file) is a plain-text configuration file that stores settings in a structured, human-readable format. Applications read these files at startup to load preferences, paths, user options, and other parameters without hardcoding values into the program itself.

The format originated with early versions of Windows and remains a standard approach in many environments today. You'll encounter INI files in:

  • Windows system and application settings
  • Game configuration (many indie and older PC games use them extensively)
  • Python's configparser library
  • Emulators, modding tools, and scripting environments
  • Custom software with simple config requirements

Understanding the INI File Structure

Before creating one, you need to know the three core components:

Sections

Sections group related settings together. They're written as a name inside square brackets:

[General] [Database] [UserPreferences] 

Keys and Values

Within each section, settings are written as key=value pairs (sometimes key: value depending on the parser):

[General] AppName=MyTool Version=2.1 DebugMode=false 

Comments

Lines beginning with a semicolon (;) or hash (#) are treated as comments and ignored by the parser:

; This is a comment # This is also a comment in many parsers 

A complete, minimal INI file looks like this:

; Application Configuration File [General] AppName=MyApp Version=1.0 [Display] Resolution=1920x1080 Fullscreen=false [Paths] DataFolder=C:UsersYourNameAppDataMyApp LogFile=logsapp.log 

How to Create an INI File Step by Step

Step 1: Open a Plain Text Editor

INI files are plain text — you must use an editor that saves without formatting. Good options include:

  • Notepad (Windows, built-in)
  • Notepad++ (free, syntax highlighting support)
  • VS Code (free, cross-platform, with INI syntax extensions)
  • TextEdit on macOS (set to plain text mode first: Format → Make Plain Text)
  • nano or vim on Linux/macOS terminals

⚠️ Never use Microsoft Word or Google Docs — they add hidden formatting characters that will break the file.

Step 2: Write Your Sections and Key-Value Pairs

Structure your content logically. Group related settings under the same section. Keep key names short, descriptive, and consistent in style (most parsers are case-insensitive for keys and sections, but not all — verify this for your specific application).

Step 3: Save with the .ini Extension

When saving:

  • Choose "Save As" and type the full filename including the extension, for example: config.ini or settings.ini
  • Set the file type to "All Files" (not .txt) — this prevents your editor from appending .txt automatically
  • Choose UTF-8 encoding unless the application specifically requires ANSI or another format

On Windows, if File Explorer is set to hide known file extensions, double-check the actual filename using the file's Properties panel to confirm it saved as .ini and not .ini.txt.

Step 4: Place the File in the Correct Location

Most applications expect their INI file in a specific location:

  • Same folder as the executable (common for portable apps and games)
  • AppData directory on Windows (%APPDATA%AppName)
  • Home directory on Linux/macOS (~/.config/appname/)
  • A path explicitly defined in the application's documentation

Check the application's documentation or source code if you're unsure where it looks for the file.

Key Formatting Rules to Get Right 🗂️

RuleDetail
No spaces in section names[MySection] not [My Section] (unless the parser supports it)
Consistent delimiterUse = or : throughout — don't mix them
No duplicate keys in a sectionMost parsers only read the first occurrence
Avoid special characters in valuesQuotes, backslashes, and symbols may need escaping
Encoding mattersStick to UTF-8 unless the app requires otherwise

Creating an INI File Programmatically

If you're building software that generates INI files, most languages have built-in or library support:

  • Python: configparser module (standard library)
  • C# / .NET: Manual string writing or third-party libraries like ini-parser
  • Java: java.util.Properties handles similar flat key-value configs
  • AutoIt / AutoHotkey: Native IniWrite() functions

Generating INI files programmatically reduces formatting errors and ensures the output matches exactly what the target application expects.

Common Mistakes That Break INI Files

  • Saving as .txt by accident — the file won't be recognized
  • Using a word processor — invisible formatting characters corrupt the file
  • Wrong encoding — applications expecting ANSI will misread UTF-8 with BOM characters
  • Duplicate section names — behavior varies by parser; some merge, some ignore the second occurrence
  • Hardcoded absolute paths — paths like C:UsersJohn break the file on any other machine

Variables That Affect Your Specific Situation

How you create and structure an INI file depends heavily on context. 🔧

The target application's parser is the most critical variable — there's no single universal INI standard. Some parsers support multi-line values; others don't. Some are case-sensitive; many aren't. Some allow inline comments after a value; others treat everything after = as part of the value.

Your operating system affects file paths, default text encoding, and where configuration files are expected to live. A Windows application and a Linux application will have different conventions even if both use INI format.

Technical skill level matters too — someone modifying a game config needs only a text editor and basic structure awareness, while a developer building a tool that reads INI files programmatically needs to choose a parser and understand its specific behavior and limitations.

The INI format is deceptively simple on the surface, but the right approach — which editor to use, where to save the file, how to structure sections, and whether to generate it by hand or programmatically — shifts depending on what you're configuring and why.