Loading TOML to ENV Converter...

Convert TOML to Environment Variables - Complete Guide

Step 1

Input Your TOML Configuration

Get your TOML configuration ready. You have a few options:

•
Paste directly: Copy your TOML from a Rust project or a Python config
•
Upload a file: Click Upload and choose a .toml file
•
Try the sample: Click Sample to see an example with nested tables and an array

TOML input example:

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

Read the Generated .env

The output appears as soon as you type. Here is how it maps TOML onto environment variables:

•
Underscore names: Nested tables become DATABASE_HOST
•
Arrays, numbered: each item becomes its own variable, like TAGS_0, TAGS_1
•
Safe to source: values are quoted so a shell never runs $(...) or expands $HOME

ENV output example:

DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_ENABLED=true
Step 3

Copy or Download

Copy the lines straight into your clipboard, or download them as a converted.env file for a Docker container, a Kubernetes deployment, or a local dotenv setup. Everything runs in your browser; the TOML is never uploaded, and reloading the page starts you with an empty editor.

FAQs About TOML to ENV Conversion

Why turn a TOML file into environment variables?

Environment variables are how most containers are configured — Docker Compose reads them from an env_file, Kubernetes puts them in a ConfigMap, and the 12-factor approach keeps config out of the code. If your settings live in a TOML file, this flattens them into the KEY=VALUE lines those tools expect.

How are nested TOML tables flattened?

Each level of the path becomes part of an uppercase, underscore-joined name. [database.credentials] with username = "admin" becomes DATABASE_CREDENTIALS_USERNAME=admin. An array of tables like [[services]] is numbered, so the first service’s name is SERVICES_0_NAME.

What happens to arrays?

Every item gets its own variable, numbered from zero: tags = ["a", "b c"] becomes TAGS_0=a and TAGS_1='b c'. Numbering each item keeps a value that contains a comma or a space from blurring into its neighbours, which a single comma-joined line would lose.

Is the output safe to source in a shell?

Yes. A value that isn’t plain letters and digits is wrapped in single quotes, so $(command), `backticks` and $HOME are written as text, not run or expanded. The same file also loads correctly with python-dotenv and Docker Compose. A rare value that holds both a single quote and a $ is escaped with a backslash, and a note points it out.

Will my numbers and dates change?

No. Long integers like 8901240544102066246, decimals written as 14.50, and strings such as "00501" come through exactly as typed, and dates stay as written. A hex integer such as 0x1F is written as its decimal value, 31.

What other TOML tools do you have?

There is TOML to JSON, TOML to YAML, TOML to XML, a TOML Formatter and a TOML Validator.