Skip to main content
Back to tools

.env Parser

Convert between .env files and JSON key-value pairs

About .env Parser

Turns a .env file into a JSON object, or writes a flat JSON object back out as KEY=value lines. Blank lines and # comment lines are skipped, surrounding quotes are removed and every value stays a string, so PORT=3000 becomes "3000". Parsing happens entirely in your browser, so the API keys and passwords in your file are never uploaded.

Category: Encoding.

Frequently asked questions

Are comments supported?

▾

Full-line comments starting with # are skipped. Inline comments are not removed: KEY=value # note produces the value "value # note", so delete trailing comments before converting.

How are quotes, the export prefix and multiline values handled?

▾

Matching single or double quotes around a value are removed, but escapes such as \n stay literal and ${VAR} references are not expanded. An export prefix becomes part of the key name, multiline values are not supported because each line is parsed on its own, and if a key repeats, the last value wins.

What JSON can I convert back to .env?

▾

A flat object of keys and values. Numbers and booleans are written as plain text and values containing a space or # are wrapped in double quotes, but embedded quotes and line breaks are not escaped, nested objects turn into [object Object] and arrays into comma-separated lists.

Should I commit my .env file to Git?

▾

No. .env files often contain secrets (API keys, database passwords). Add .env to .gitignore. Commit a .env.example with placeholder values to document required variables.

Related tools