How to use the INI formatter
- Paste your file into the Input box. The sample has untidy spacing, a padded
[ server ]header and several blank lines. - Tick or untick the options: Spaces around = (on by default), Align = within each section and Sort keys within sections.
- Copy the Formatted INI or download it as
settings.ini.
What it does and when to use it
INI files are edited by hand over years, so they collect mixed key=value and key = value spacing, stray blank lines and headers like [ database ]. This tool gives the whole file one style. Aligned values are easier to scan in long sections, and sorted keys make it simple to compare two server configs line by line in the code diff viewer.
Similar clean-ups exist for other config formats: the Java properties formatter for .properties files, the env file sorter for .env files, and the TOML formatter for TOML.
How it works
The formatter does not use a parser library; it reads your text line by line:
- Blank lines are dropped, then one blank line is put back before each section.
- A line in square brackets starts a section, and the spaces inside the brackets are trimmed.
- A line starting with
;or#is a comment and is held until the next key or section, so it moves with that line. - Any other line with
=or:is split into key and value at the first separator. Lines with neither, such asskip-name-resolve, are kept unchanged.
With Align on, each key is padded to the longest key in its section. It all runs in your browser.
Worked examples
These are the tool’s own outputs.
The sample. [ server ] becomes [server], port =8080 and user= app become port = 8080 and user = app, the three blank lines shrink to one, and the # secret goes in env comment stays above name = prod_db.
Aligned git config.
[core]
editor = vim
autocrlf = input
excludesfile = ~/.gitignore ; global
The input had autocrlf : input, now an equals sign. The ; global note after the value is part of the value and is kept.
Sorted MySQL options, no spaces. With Sort keys on and Spaces around = off, the [mysqld] keys come out as bind-address, then the ; keep small comment with max_connections=50, then port=3306 and skip-name-resolve.
Limits and tips
- Your own blank lines inside a section are removed. Use comments to group keys instead.
- Multi-line values written with a backslash or extra indentation are treated as separate lines.
- Duplicate keys are not reported. Watch for them when sorting brings them together.
Frequently asked questions
Are comments kept?
What happens to a colon separator?
Does it sort sections as well as keys?
Will it change my values?
Which files can I use it for?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.