Convert a .env file to a JSON object, with quotes, comments and multi-line values handled
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.Paste a .env file and get the same variables as a JSON object, read the way the dotenv package reads them: comments dropped, quotes removed, \n turned into a line break inside double quotes, and the last of two duplicate keys kept. That makes it easy to load the settings into a config service, a test fixture or a cloud secret store that wants JSON.
Paste or type your input.
Choose the options you need.
Press Ctrl+Enter, then copy or download.
A .env file looks simple, but small slips change what the program receives without any error: a # inside a password cuts it short, an unclosed quote becomes part of the value, and a second line with the same key quietly replaces the first. This tool reads the file exactly as the dotenv package does and shows every such line.
| Problem | Example | What happens |
|---|---|---|
| Not an assignment | just some text |
ignored |
| # in an unquoted value | PASS=abc#123 |
read as abc |
| Unclosed quote | NAME="Asha |
value keeps the quote |
| Duplicate key | PORT twice |
the last one wins |
| Name a shell rejects | feature.flags=on |
source .env fails |
| Undefined reference | ${REDIS_HOST} |
left as written |
| Spaces without quotes | FROM=Example Team |
breaks in a shell |
Conversions. The variables, as dotenv reads them, can be copied or downloaded in 5 forms: a JSON object; YAML, with every value kept as a string so 0123 and true are not reinterpreted; shell export lines with safe single quotes; a Docker env file, which cannot carry multi-line values; and a .env.example with every key and no values, ready to commit.
The rest of the article, and all 6 questions about .env File Validator, are on the .env File Validator page.
In a .env file, a # starts a comment, even in the middle of an unquoted value, so PASSWORD=abc#123 is read as abc. Put the value in quotes, PASSWORD="abc#123" or PASSWORD='abc#123', and the whole text is kept. Every line with this problem is flagged here with its line number.
Wrap the value in double quotes and either break the lines for real or write \n where each break goes. dotenv reads both, and turns \n into a line break only inside double quotes. Single quotes and backticks also span lines but keep \n as written. A Docker env file cannot hold multi-line values at all.
The last value wins, with no warning from dotenv, so a PORT set near the top can be silently replaced by another PORT further down. This tool lists every duplicate with the line of the first definition, so you can delete the one that should not be there.
Not by dotenv itself: API=${HOST}/api stays exactly as written. Docker Compose and the dotenv-expand package do replace ${HOST} with its value, and ${HOST:-fallback} supplies a default when HOST is unset. References to names the file never defines are flagged here, because they become empty in those tools.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about .env File Validator and anybody who knows can answer. No account needed.
On the related tools: Readability Checker – Flesch reading ease and grade level, with what to change · JSONPath Evaluator – Evaluate a JSONPath expression and get the matching values and their paths.