Env File Converter
Convert between .env, JSON and YAML — the same config in three syntaxes.
Paste input on the left.
How it works
A `.env` file, a JSON config object and a flat YAML mapping are the same information in three syntaxes a deployment pipeline is likely to actually want — a Kubernetes ConfigMap in YAML, a Node script reading JSON, a container runtime reading `.env` directly. This reads whichever one you paste and writes whichever one you pick.
No variable expansion, in either direction
A value of $OTHER_VAR or ${OTHER_VAR} is left exactly as written. Expanding it
is a convention some loaders add on top of the base `.env` format — Docker Compose and `dotenv-expand` do it,
plain `dotenv` does not — and guessing which convention your consumer expects would produce a wrong answer more
often than a right one.
JSON and YAML must be flat
A `.env` file has no way to represent a nested object or an array — every shell environment is a flat list of NAME=value pairs. Converting a nested JSON or YAML document into `.env` fails with the exact key that is nested, rather than silently flattening it with an invented naming scheme nobody asked for.
Example
{"PORT":"8080","DEBUG":"true"} converts to PORT=8080 and DEBUG=true as
`.env` lines, or to a two-key YAML mapping — same data, different syntax.
Frequently asked questions
How is the input format detected?
By shape, checked in order: valid JSON is JSON; otherwise, if every non-comment line matches KEY=value, it is read as .env; otherwise it is parsed as YAML. A flat YAML mapping of bare KEY: value pairs can resemble .env, which is why the .env check runs first — it is the more constrained shape of the two.
Why does converting to .env sometimes fail?
Because the source has structure a .env file cannot hold. Every real shell environment is a flat list of NAME=value pairs, so a nested object or an array in your JSON or YAML has nothing to convert into — the error names the exact key that is nested rather than guessing at a flattening scheme.
Is anything sent anywhere?
No. Parsing and conversion both happen in your tab. A .env file routinely holds live database credentials and API keys, which is exactly the case where a server-side converter would be the wrong tool regardless of how it is marketed.
Related tools
.env Validator
Check a .env file for duplicate keys, invalid names and unterminated quotes.
LocalEnv Diff
Compare two versions of a config file line by line.
LocalYAML to JSON Converter
Convert YAML to JSON and back, with what the conversion costs stated rather than dropped.
LocalINI ⇄ JSON Converter
Convert INI to JSON and back, with sections becoming nested objects.
LocalGitignore Generator & Checker
Generate a .gitignore for common stacks, or check whether a path is actually ignored.
LocalTOML to JSON Converter
Parse a TOML document — tables, arrays of tables and all — into JSON.
Local