How to use
- Choose the input format (.env, JSON, YAML or docker run -e flags) and paste your content. A sample is pre-filled so you see a result right away.
- Choose the output format: .env, JSON, YAML,
docker run -eflags, adocker --env-filefile, composeenvironment(map or list) or shellexportstatements. - Turn on blank values, sort, nest or type conversion if you need them.
- Copy the result or download it under a fitting file name (
.env,env.json,docker-run.shand so on). Pasting the result back as input also works, so round trips are possible.
Conversion example
Converting NODE_ENV=production, PORT=3000 and GREETING="hello world":
| Output format | Result |
|---|---|
| JSON | {"NODE_ENV": "production", "PORT": "3000", "GREETING": "hello world"} (all values are strings) |
| YAML | Values that look like numbers are quoted to stay strings, like PORT: "3000" |
| docker run | A command with -e NODE_ENV=production -e PORT=3000 -e GREETING='hello world', one flag per line |
| compose map | KEY: value under environment: |
| compose list | - KEY=value under environment: |
| export | export GREETING='hello world' |
Rules per format
- Reading .env: supports
#comments, theexportprefix, empty values, single quotes (literal), double quotes (\nand\"escapes) and multi-line double-quoted values. In an unquoted value, a#after whitespace starts a comment whilea#bis kept. A repeated key keeps the last value and is reported. - Reading JSON and YAML: nested objects and arrays are flattened into single-level keys like
DATABASE_HOSTandTAGS_0. Characters not allowed in keys become_, and numbers, booleans and null become strings (3000,true, empty). A pasted composeenvironment:block or a- KEY=VALUElist is understood too. - Writing JSON and YAML: by default every value is written as a string. With type conversion, only values like
true,falseand3000become booleans or numbers, and values with a leading zero such as007stay strings. With nest,DB__HOST=hbecomes{"DB": {"HOST": "h"}}, the same double-underscore convention used by .NET configuration. - docker –env-file: this format does not strip quotes and has no multi-line values. So
KEY=valueis written as is, and multi-line values are skipped with a notice. Choose it separately from the.envformat. - compose:
$starts variable substitution in compose files, so a$in a value is written as$$. For examplecost $5becomescost $$5. - Shell quoting:
docker runandexportoutput wraps values in single quotes and writes a'inside as'\'', so a value with spaces,$or a semicolon is never run as a command. Keys that break shell variable naming (letters, digits,_) are skipped.
Blank values and secrets
- Blank values empties every value so the result works as a
.env.example. For files you commit, share this form instead of real values. - Avoid pasting production secrets (passwords, API keys, tokens) even here. This tool runs only in your browser, but screenshots and screen sharing can still expose them. Review the result before using it.
- To use the converted
.envwith containers, build a compose file with a.env.exampleusing the Docker Compose Generator and the image with the Dockerfile Generator. To run it as a host service, useEnvironmentFilefrom the systemd Service Generator. Check YAML structure with the JSON YAML Converter, compare two.envfiles with Text Diff and tidy JSON with the JSON Formatter.
Frequently asked questions
When do I need quotes in a .env file?
For values with spaces, # or $, quotes are the safe choice. Single quotes keep the content as is, while double quotes interpret escapes like \n. This tool adds single quotes only where needed when writing.
Is docker run –env-file different from compose env_file?
Yes. docker run --env-file does not strip quotes and keeps them in the value, while compose .env and env_file interpret quotes and variable substitution. Pick the output format that matches where it will be used.
Do numbers become strings in JSON?
Environment variables are strings by nature, so the default is "3000". If your app expects numbers, turn on type conversion.
How do I use nested JSON as environment variables?
Reading flattens it into keys like DATABASE_HOST. Turn on “Uppercase keys” to get uppercase names. To go back from DB__HOST to nested JSON, use “Nest”.
Is my input sent to a server?
No. The conversion happens in your browser only.
Your input is converted in this browser and never sent to a server.