.env to TOML converter: turns environment variables into a TOML config file with tables, numbers and lists.
Convert ENV to TOML - Complete Guide
Input Your Environment Variables
Get your .env file ready. You have several convenient options:
.env file or Docker ComposeENV format example:
DATABASE_HOST=localhost DATABASE_PORT=5432 DATABASE_ENABLED=true
Automatic Conversion to TOML
The output updates as you type, written as TOML. Here is what happens to your variables:
TOML output example:
[database] host = "localhost" port = 5432 enabled = true
FAQs About ENV to TOML Conversion
Why turn a .env file into TOML?
A .env file is a flat list of NAME=value strings. TOML lets you group settings into tables, keep comments next to them, and store real numbers, booleans and lists, which is why tools like Cargo, pyproject.toml and many app config.toml files use it. Converting is a quick way to start a structured config from variables you already have.
How do underscores turn into tables?
Each underscore starts a new level, and names are lowercased: DATABASE_CREDENTIALS_USERNAME=admin becomes username = "admin" under [database.credentials]. If one name is both a value and the start of longer names, such as DB=primary next to DB_HOST=db.local, TOML can't make db a value and a table at the same time, so that group stays flat as db = "primary" and db_host = "db.local". Names that differ only in case (Api_Key and API_KEY) keep their own name at the top. A note above the output tells you when either happens.
Will any of my values change?
A value only becomes a TOML integer, decimal or true/false when reading it back gives exactly the text you wrote. 8080 and 8901240544102066246 become integers; 00501, 14.50, 1.10 and 1e3 stay quoted text, because a TOML reader would hand back 501, 14.5, 1.1 or 1000. Quoted values always stay text, and an empty value becomes "" because TOML has no null.
When does a value become a list?
When it is unquoted and made of short plain items separated by commas with no spaces, like key1,key2,key3 or 1,2,3. A sentence such as Hello, world or a URL with commas in it stays one string. If you want a comma-separated value kept as text, put quotes around it in the .env file.
How are quotes, comments and $ signs read?
The same way python-dotenv reads them. A # after a space starts a comment, but #ff0000 or the # in a URL is kept. Double-quoted values understand \n and the other backslash escapes and may run over several lines; single-quoted values are taken literally apart from \' and \\. References like $HOME or ${PORT} are copied as written, not expanded, and lines starting with export work too.
Is my .env file uploaded anywhere?
No. The conversion runs in your browser; nothing you paste or upload is sent to a server, and reloading the page starts with an empty editor. A .env file often holds passwords and API keys, so it is still worth stripping real secrets before pasting it into any web page.
Going the other way? TOML to ENV turns a TOML file back into variables. You can also tidy the result with the TOML Formatter, check it with the TOML Validator, or turn it into JSON, YAML or XML.
Related Tools
JSON to TOML
Convert JSON data to TOML configuration format for Rust and other projects
TOML to JSON
Convert TOML configuration files to JSON format with syntax validation
TOML Formatter
Format and beautify TOML configuration files with proper indentation
TOML Fixer
Fix broken TOML config files automatically, repair syntax errors, and validate TOML structure
TOML Validator
Validate TOML syntax and structure with error detection
YAML to TOML
Convert YAML configuration files to TOML format for Rust projects