.env ↔ JSON converter — offline
Move between environment files and JSON without your secrets ever leaving the browser.
Convert .env files to JSON without uploading your secrets
A .env file is, almost by definition, the most sensitive text file in a project. Database passwords, API keys, signing secrets, third-party tokens — the whole point of the file is to hold the values that must not be committed or shared. Pasting one into an online converter uploads every credential in it to an unknown server in a single action, and the correct response afterwards is to rotate all of them.
This converter runs entirely in your browser. Nothing is transmitted, logged, or stored; the site has no backend, and a Content-Security-Policy blocks third-party requests. Verify it in DevTools → Network, or disconnect from the internet and watch it keep working. This is the tool on the site where that guarantee matters most.
The .env syntax that is understood
Real .env files are messier than the format suggests, so the parser handles the variations you actually encounter:
KEY=valuelines, with or without surrounding whitespace.- Single and double quoted values, for values containing spaces or
#. - Escaped
\ninside double quotes — the usual way a multi-line private key gets squeezed onto one line. - Comments beginning with
#, and optionalexportprefixes from files that double as shell scripts.
Why the JSON has to be flat
Converting JSON back to .env requires a flat object: every entry is a single key and a string value. The .env format has no concept of nesting, so a nested JSON object simply cannot be represented — there is no syntax for it to convert into.
Everything is a string on the environment side, too. Numbers and booleans become their text representations, which is why application code reading process.env has to parse them explicitly, and why the string "false" is famously truthy in a naive check.
Converting in this direction is most often about moving values into a deployment platform's JSON-based secret store, or comparing two environments. For the latter, convert both and use the diff checker to see which keys differ — again, all on your device. Related: JSON, YAML and TOML converter and JSON formatter.
How to convert a .env file to JSON offline
- 1
Pick the direction (.env → JSON or JSON → .env).
- 2
Paste the content — conversion is live.
- 3
Copy the converted result.
.env ↔ JSON — frequently asked questions
Is it safe to paste a real .env file here?
Yes — that's the point. .env files are full of secrets, and this converter runs entirely in your browser: nothing is transmitted, logged, or stored. Verify in DevTools → Network.
What syntax is understood?
KEY=value lines, single/double quotes, escaped \n in double quotes, comments (# …), and optional export prefixes.
Why must the JSON be flat?
.env has no nesting — every entry is a single key and a string value, so nested JSON objects can't be represented.