Skip to main content

.env to Netlify TOML

Turn a .env file into a netlify.toml environment block for any Netlify deploy context

.env Input

Limit: 500,000 characters.

Options

Replaces secret-looking values with "<REDACTED>".

netlify.toml Output

netlify.toml is usually committed to source control. Avoid production secrets in it unless intended. Secret-looking keys: 0.

Paste a .env file, load a file, or load an example.

How to Use

  1. 1.Paste a .env file, load one, or load an example.
  2. 2.Choose the deploy context: Production, Deploy Preview, Branch Deploy, Dev, All contexts or a custom branch.
  3. 3.Turn on Safe Template Mode to replace secret-looking values with "<REDACTED>".
  4. 4.Optionally turn on Sort Keys or Keep Comments.
  5. 5.Copy the TOML or download netlify.toml and merge it into your existing file.

.env to Netlify TOML

Convert a .env file into a netlify.toml environment block for one Netlify deploy context. Each variable becomes a KEY = "value" line with correct TOML escaping, in the same order as your file.

Parsing Rules

Supports KEY=value, export KEY=value, spaces around =, empty values, single quotes (literal), double quotes (\n, \", \\ escapes) and multiline quoted values. A # starts a comment only at the start of a line or after whitespace in an unquoted value; # inside quotes is kept. Values containing = stay intact. Duplicate keys keep the last value, like dotenv, and are reported with line numbers.

Limits and Privacy

netlify.toml is normally committed to your repository, so keep production secrets in the Netlify UI or CLI unless you intend to commit them. Secret detection is a key-name heuristic and can miss or over-match keys. Conversion runs in your browser; the .env text is not uploaded or saved, and only options are kept in browser storage.

Frequently asked questions
Which netlify.toml table does the converter write?
The one for the context you choose: [context.production.environment], [context.deploy-preview.environment], [context.branch-deploy.environment], [context.dev.environment], [context."<branch>".environment] for a custom branch, or [build.environment] for all contexts. Branch names that are not bare TOML keys, such as feature/login, are quoted.
Should I put secrets in netlify.toml?
Usually not. netlify.toml is normally committed to your repository, so anyone with read access sees its values. Keep production secrets in the Netlify UI or CLI, and use Safe Template Mode to replace secret-looking values with <REDACTED> when you only need the structure.
How are quotes, escapes and comments handled?
Single-quoted values are literal; double-quoted values decode \n, \r, \t, \" and \\. Inline comments after unquoted values are removed and can be kept as TOML comments under Advanced. Every value is then written as a TOML basic string with backslashes, quotes and control characters escaped.

CodingTool is officially live on