Back to Tools

Config File Formatter

Auto-detect and beautifully format INI, JSON, and ENV files.

Input Data

What the Config File Formatter does

Configuration files tend to pick up messy spacing over time: one developer writes port=3306, another writes port = 3306, and a minified JSON blob arrives from an API on a single line. This tool takes whatever raw configuration you paste in, works out whether it looks like JSON or INI, and returns a cleaner version you can read at a glance.

Using it step by step

  1. Paste your configuration into the Input Data box. If you just want to see how it behaves, press Sample to load a small INI example.
  2. Click Process / Generate.
  3. Check the line above the output that reads Detected Format. It will say JSON, INI or ENV/Text.
  4. Use Copy to put the result on your clipboard, or Download to save it as result.txt. Clear empties the input box so you can start over.

How each format is handled

  • JSON: if the text starts with a brace or bracket and parses successfully, it is re-indented with four spaces per level.
  • INI: if the text contains square brackets and is not valid JSON, each [section] header is placed on its own line and every key = value pair beneath it is indented and colour-coded.
  • Everything else: treated as ENV/Text. Equals signs get a space on each side and all runs of whitespace are collapsed.

Where it helps

Things to keep in mind

Detection is simple pattern matching, not a full parser. Invalid JSON that begins with a brace will fall through to the INI or text rules, so a missing comma will not produce an error message. An INI file with no square brackets is treated as ENV/Text, and in that mode line breaks are collapsed too, which flattens multi-line files into one line. If you have a real .env file, the dedicated .env Formatter keeps one variable per line and is the better choice.

Comments in INI files (lines starting with a semicolon or hash) are kept but shown in a muted style rather than coloured as keys. Processing happens with JavaScript in your browser page, so the result appears instantly without a page reload.

Related Articles

Related Tools







Frequently Asked Questions

Which file types does the Config File Formatter recognise?
It recognises three outcomes: JSON, INI, and a fallback labelled ENV/Text. JSON must start with a brace or bracket and parse correctly. INI is chosen when the text contains square brackets. Anything else is treated as plain key=value text.
Why did my multi-line .env content turn into one line?
When input matches neither JSON nor INI, the fallback mode adds spaces around equals signs and collapses all whitespace, including line breaks. For files with one variable per line, use the .env Formatter instead, which preserves line structure and aligns keys.
Does it validate my JSON?
Not as a validator. It only reformats JSON that parses cleanly. If parsing fails, the tool does not show a JSON error and instead tries the INI and text rules, so use a dedicated JSON validator when you need to find syntax problems.
Can I save the formatted output?
Yes. After processing, press Copy to place the text on your clipboard or Download to save it as result.txt. Rename the file with the correct extension, such as .json or .ini, before using it in a project.
What indentation does the formatted JSON use?
Formatted JSON uses four spaces per nesting level. The tool has no option to change this. If your project uses two spaces or tabs, paste the result into your editor and run its own formatter afterwards.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.