Loading INI to ENV Converter...
How to Convert INI to ENV - Step by Step Guide
Input Your INI Configuration File
Moving a service from an INI config to environment variables, say for Docker or a twelve-factor app? Start by getting the INI into the editor:
Let It Convert
There is no button to press. About half a second after you stop typing, the converter reads the INI and:
Review the ENV Output
A [database] section with host = localhost comes out as DATABASE_HOST=localhost. A few things to know about the result:
Export Your ENV Data
When the variables look right, take them with you:
Frequently Asked Questions
How are the variable names built?
The section name and the key are joined with an underscore and written in capitals, so host under [database] becomes DATABASE_HOST. Dots, dashes and spaces turn into underscores ([my-app.sub] some-key gives MY_APP_SUB_SOME_KEY), accents are dropped and keys that sit above every section keep just their own name. If two keys end up with the same name, the second one gets _2 on the end and a note above the output says which.
Will my values change on the way through?
No. Every value is copied as text, so 00501 keeps its leading zeros, 14.50 keeps its trailing zero and a long ID like 8901240544102066246 keeps every digit. A ; or # only starts a comment when there is a space in front of it, so pw = abc#123, color = #ff0000 and a URL ending in #top all stay whole. Quoted INI values keep the spaces inside the quotes.
Is the .env file safe to load in a shell?
Yes. Plain values are written as they are and anything else goes in single quotes, so $HOME, $(command) and backticks stay plain text. python-dotenv, Docker Compose and set -a; . ./converted.env in bash all read the same values, and sourcing the file never runs anything. The one exception is a value that holds both a ' and a $ or backtick: it goes in double quotes with a backslash before the $, which bash removes but python-dotenv keeps, and a note names that variable. python-dotenv also expands ${NAME} inside quotes unless you load the file with interpolate=False.
What happens to comments, repeated keys and lists?
INI comments are left out, and each section gets a # [section] line in front of its variables so you can see where they came from. When a key appears twice in one section the last value wins, the way INI readers treat it, and a repeated [section] has its keys merged; both come with a note. Lists written as key[] = value become KEY_0, KEY_1 and so on, and a bare word with no = sign is read as a switch set to true.
Why is the download called converted.env?
Browsers rename a file whose name is only .env, so the download gets a name in front. Rename it to .env, or point your tool at it directly; docker run --env-file and docker compose env_file accept any file name.
Is my INI file uploaded anywhere?
No. The conversion runs in your browser, nothing you paste or upload is sent to a server, and nothing is kept: a reload starts with an empty editor. Config files often hold passwords, so it is still worth checking what you paste into any web page.
Background reading: Python's configparser documentation covers the INI format, and the twelve-factor guide to config explains why apps read settings from the environment.
Related Tools
INI Formatter
Format and beautify INI configuration files with proper structure
INI Validator
Validate INI syntax and structure with detailed analysis
INI Fixer
Fix broken INI config files automatically, repair missing sections, duplicate keys, and syntax errors
INI to JSON
Convert INI configuration files to JSON format
JSON to INI
Convert JSON data to INI configuration format
INI to YAML
Convert INI configuration files to YAML format