Loading ENV to TOML Converter...

Convert ENV to TOML - Complete Guide

Step 1

Input Your Environment Variables

Get your .env file ready. You have several convenient options:

•
Paste directly: Copy from your .env file or Docker Compose
•
Upload file: Click Upload and pick a .env or .txt file (up to 10 MB)
•
Try sample: Click the Sample button to see a working example

ENV format example:

DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_ENABLED=true
Step 2

Automatic Conversion to TOML

The output updates as you type, written as TOML. Here is what happens to your variables:

•
Tables from names: each underscore in a name starts a new level, so DATABASE_PORT lands in [database]
•
Exact values: numbers and true/false become TOML types only when they read back unchanged; 00501 and 14.50 stay text
•
Lists: comma-separated values such as key1,key2,key3 become arrays, handy for Rust and Python configs

TOML output example:

[database]
host = "localhost"
port = 5432
enabled = true
Step 3

Download or Copy Result

Copy the TOML or download it as converted.toml. If the variables came from a Docker Compose setup and are headed for a Rust app, read the note above the output first: it tells you which values became lists and which names stayed flat.

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.