Developer Tools

INI File Formatter

Tidy INI-style configuration files such as php.ini, my.cnf, desktop entries, setup.cfg and many application settings. Spacing around = becomes consistent, sections are separated by one blank line, values can be aligned and keys sorted, comment markers can be unified, and comments stay attached to the lines they describe. Duplicate keys, repeated sections and lines that are not key = value are reported.

  • Runs in your browser
  • No sign-up
  • Free to use

How to use INI File Formatter

  1. Paste an INI or CFG file.
  2. Choose the assignment style and comment marker.
  3. Optionally align values and sort keys.
  4. Click Format and review the warnings.

INI File Formatter features

Consistent style

key = value, key=value or key: value.

Comments kept

Comments stay with the section or key they precede; inline comments too.

Alignment

Values aligned within each section.

Sorting

Keys sorted alphabetically within sections.

Problem detection

Duplicate keys, sections defined twice and malformed lines.

Quote-aware

Semicolons inside quoted values are not mistaken for comments.

When to use INI File Formatter

  • Cleaning up a php.ini or my.cnf after many manual edits.
  • Making configuration files consistent across servers.
  • Finding duplicate settings that override each other.
  • Preparing a readable settings file for documentation.

INI File Formatter FAQ

Is there an INI standard?

No single one. INI is a family of similar formats; this formatter follows the common rules: [sections], key = value or key: value, and comments starting with ; or #.

What happens to duplicate keys?

They are kept as written and reported, because most readers use the last value and the earlier line is probably a mistake.

What if a section appears twice?

Its keys are merged under the first occurrence and the repetition is reported.

Will sorting break anything?

Usually not, but some programs read keys in order. Leave sorting off for files where order matters.

Are quoted values changed?

No. Values are kept exactly, including quotes; only surrounding whitespace is normalised.

Is my file uploaded?

No. Formatting runs in your browser.

Tidying INI configuration files

INI files are among the oldest configuration formats still in daily use: PHP, MySQL, Git, Python’s setuptools, Windows applications and desktop environments all read variations of them. The format is simple, with section headers in brackets and key-value lines below, which is why it is often edited by hand and gradually becomes inconsistent.

The formatter reads the file line by line. Section headers are recognised with or without stray spaces inside the brackets, keys and values are split at the first equals sign or colon, and comments starting with a semicolon or hash are kept with the line that follows them, so explanations stay next to the settings they describe.

Inline comments need care, because a semicolon or hash can also appear inside a value. The formatter treats them as comments only when they follow whitespace and lie outside quotes, so a quoted password containing a semicolon stays intact. Values themselves are never rewritten beyond trimming surrounding whitespace.

Formatting options cover the usual styles. The assignment can be written with spaces around the equals sign, without spaces, or with a colon; values can be aligned within each section; keys can be sorted; and comment markers can be unified to semicolons or hashes. One blank line separates sections and runs of blank lines are collapsed.

Problems are reported rather than silently fixed. A key that appears twice in a section is usually an override nobody intended, a section that appears twice may be merged differently by different programs, and a line without an equals sign or colon is probably broken. Each is listed with its line number.

Other useful tools