Env File Parser
Parse a .env (dotenv) file into clean key/value pairs and re-emit it as normalized ENV, a JSON object, or shell export statements — sorted, de-duplicated, with a report of missing '=', duplicate keys and empty values. Optionally mask secret values.
Input
Options
Replace every value with ***** — useful for sharing a redacted config.
Output
| Type | Line | Message |
|---|---|---|
| No data yet | ||
Guides
What does this tool do?
Paste the contents of a .env (dotenv) file and the Env File Parser reads every KEY=value line, then hands you back a tidy, sorted version in the format you choose:
- Clean ENV — the same
KEY=valuelayout, but sorted alphabetically, de-duplicated, with comments and blank lines stripped and values quoted only when they need it. - JSON — a
{ "KEY": "value" }object, ready to drop into a config loader, a test fixture, or a request body. - Shell Export — one
export KEY="value"per line, so you cansourcethe result straight into a shell session.
Alongside the output it reports parse issues — lines missing an =, duplicate keys (with the line each was first seen on), and keys with empty values — so a malformed env file is easy to spot and fix.
How to use it
- Paste your
.envcontent into the ENV Content box, or click Try an example to load a sample. - Pick an Output Format: Clean ENV, JSON, or Shell Export.
- Optionally turn on Mask Values to replace every value with
*****— handy when you want to share the shape of a config without leaking secrets. - Read the normalized result, and scan the Parse Issues table for anything that needs attention.
- Copy or download the output (
.env, or CSV for the issues list).
The tool understands the common dotenv conventions: an export prefix on a line, single- or double-quoted values, and trailing # inline comments (a # inside a quoted value is left alone).
FAQ
How are duplicate keys handled?
The last occurrence of a key wins in the output — matching how most dotenv loaders overwrite earlier values — and every duplicate is flagged in the issues table with the line number of the first definition.
Why are my comments and blank lines gone?
The output is sorted and de-duplicated, so a comment's original position can't be preserved — full-line # comments and blank lines are always dropped. Inline # comments after a value are stripped from that value too.
Does it change my values?
No. Values are only unquoted (surrounding quotes removed) and re-quoted when a format requires it (for example, a value containing a space). Turning on Mask Values is the one exception — it deliberately replaces every value with *****.
Can it convert a .env file to JSON?
Yes — choose the JSON output format and you get a { "KEY": "value" } object with keys sorted alphabetically.
Privacy
Everything runs entirely in your browser — the env content you paste is never uploaded to any server. That matters here: .env files routinely hold database passwords, API keys and access tokens. Nothing is logged, and sharing a link to this tool never includes your pasted content (only your format and mask settings). For extra safety when sharing output, enable Mask Values.