convert

.env to JSON

Convert a .env file to a JSON object, handling comments, quotes, export prefixes and multi-line values.

Runs on your deviceBatch readyPaste textNew

Paste or drop

Paste text below, or drop a file instead.

0 chars · 0 lines
…or drop a file
Drag and drop, or choose files
ENVTXT

Choose an output

Convert a .env file to a JSON object, handling comments, quotes, export prefixes and multi-line values.

Fine-tune

Optional — sensible defaults are already set.

About .env to JSON

This converter reads a .env file and outputs a JSON object of key-value pairs. It skips blank lines and # comments, strips export prefixes, handles single, double and backtick quotes, removes trailing inline comments from unquoted values, and supports quoted values that span several lines. Your secrets stay in the browser tab.

When it helps

  • Moving local environment variables into a JSON-based secrets manager or deployment config.
  • Generating a JSON settings file from a .env for a serverless platform or test harness.
  • Comparing two .env files by converting them to JSON and diffing the result.

Tips

  • By default every value stays a string, which is how process.env sees them. Turn on "Convert numbers and booleans" to get PORT as 3000 and DEBUG as true instead.
  • Inside double quotes, the escapes \n, \t and \" are expanded. Single-quoted values are taken literally.
  • Variable references like ${HOME} are not expanded; they are kept as literal text.

Good to know

Quick answers about .env to json in your browser.

The file is parsed by JavaScript in your browser and is not sent to a server. Still treat the generated JSON as a secret and avoid committing it.

The last occurrence wins, which matches how dotenv and most shells behave when a variable is assigned twice.

Yes. There is no sign-up, no watermark and no limit on how many files you process.

No. Files are read and processed locally in your browser, so they never leave your device.

Related tools