.env File Converter
Convert .env files to JSON, YAML, docker-compose environment blocks or shell export lines, and back.
Runs in your browser Your input never leaves your device.
Values are never expanded: $HOME or ${DB} stay as written. The shell export output single-quotes every value so sourcing it cannot run anything. Secrets stay in your browser, but avoid pasting production secrets into any web page you do not trust.
Report a problem with this tool
About this tool
Paste the contents of a .env file and see it as a cleaned-up .env, as JSON, as YAML, as a docker-compose environment list or map, or as shell export lines. You can also paste a JSON object and get the .env version; nested objects are flattened with underscores (DB.HOST becomes DB_HOST) unless you turn that off. The reader understands comments, the optional export prefix, single-quoted values (kept literally), double-quoted values (with \n, \t and \" escapes, and values that run over several lines) and unquoted values with a trailing # comment. Variable references such as $HOME or ${DB_HOST} are not expanded; they are copied as written. Values are quoted in the output only when needed, and a value containing a dollar sign is single-quoted so docker compose will not expand it. The shell export output single-quotes every value, so sourcing it cannot run any command. Lines that are not KEY=value, invalid names and duplicate keys are reported. Everything runs in your browser.
How to use it
- Paste a .env file or a JSON object.
- Choose the output format with the tabs.
- Check any warnings about ignored lines or duplicate keys.
- Press Copy.
Common problems
- A value with $ comes out single-quoted
- Docker compose and dotenv-expand expand $VAR inside double quotes but not inside single quotes, so the output keeps your literal text safe.
- My YAML number became a string
- Environment variables are always text, so values like 3000 or true are written as quoted strings in YAML to stop a parser from turning them into numbers or booleans.
- Some lines are missing
- They did not look like KEY=value, or the name had characters other than letters, digits, underscore, dot and hyphen. The warning lists each ignored line.