LOCAL ENVIRONMENT CHECKER
Compare .env Files Locally with an Env File Validator
Paste or load two environment files to compare valid keys, locate line-numbered issues, keep values hidden, and download a sanitized `.env.example` template.
Private by design: files stay in this browser and are never uploaded.
Comparison
Missing from right
Extra in right
Duplicate keys
Format issues
Interpolation notes
Preset guidance
Sanitized template
PORT= API_KEY=
What this .env validator checks
This local environment checker parses each non-comment assignment in your pasted text. It accepts variable names that start with a letter or underscore and continue with letters, numbers, or underscores. It reports missing = signs, invalid variable names, and unclosed quoted values with 1-based source line numbers.
The comparison shows keys found on the left but not the right, keys found on the right but not the left, duplicate key occurrences, format errors, and a key parity percentage. Values are not rendered in the comparison. Keys whose names look like KEY, SECRET, TOKEN, PASSWORD, PASS, PRIVATE, or CREDENTIAL are marked as secret-like; this is a name-based warning, not proof that a value is secret.
How to compare .env files
- Paste or load the first file in the left editor and the second file in the optional right editor.
- Choose a framework preset if you want Node, React, Next, Vue, or Docker guidance; enable Docker Compose interpolation hints when needed.
- Select Parse & compare, review the line-numbered report, then download the sanitized
.env.exampletemplate.
How the comparison works
The tool builds one set of valid keys for each side. The displayed missing list is:
leftKeys − rightKeys
The displayed extra list is:
rightKeys − leftKeys
Shared keys are counted as the intersection of the two sets. Parity is calculated as:
round((sharedKeys / unionOfAllKeys) × 100)
When both sets are empty, parity is shown as 100%. Key matching is exact and case-sensitive, so API_URL and api_url are different keys. Duplicate keys remain visible with every source line; the interface notes that the last definition is effective. The exported template contains each valid left-side key once as KEY= and does not copy values.
Line endings are normalized for parsing. Blank lines and lines beginning with # are ignored. A leading export is removed before parsing. Values are trimmed, and a # preceded by whitespace starts an unquoted comment; a # inside a quoted value is retained. Matching outer single or double quotes are removed. The current parser does not evaluate variable values or perform general dotenv expansion.
Docker Compose interpolation hints
When enabled, the tool scans values for the supported forms ${VAR:-default} and ${VAR-default}. It does not evaluate them against your local environment. :- treats an unset or empty variable as needing the default; - uses the default only when the variable is unset, while an empty value is retained.
Privacy and sanitized templates
Processing happens in the browser. The page does not upload the pasted text, place it in the URL, or save it to browser storage. Results keep values hidden by default. Even so, avoid pasting production secrets into any web tool when a local-only workflow is required. The download contains key names with empty assignments, not the original values.
FAQ
What is the difference between .env and .env.example?
A .env file commonly contains machine-specific configuration and may contain real secrets. A .env.example file is normally a safe list of required variable names with empty values or placeholders. This tool can generate a key-only template from the left input.
How do I check for missing environment variables in .env?
Put the file you want to check on the left and the reference file on the right, then parse the inputs. The Missing from right list contains valid keys present on the left but absent on the right. The Extra in right list shows the reverse difference.
Does the validator show my environment-variable values?
No. The comparison renders key names and source-line information while keeping values hidden. The sanitized template also writes empty assignments rather than copying parsed values.
How are duplicate keys handled?
Every valid occurrence is retained in the report, including its source line. The interface labels the last definition as effective, but dotenv loaders can differ, so verify the behavior of the loader used by your application.
How are quotes and # comments parsed?
Blank and comment lines are skipped. An unquoted # preceded by whitespace starts a comment, while a # inside matching quotes remains part of the value. Matching outer single or double quotes are removed. An unclosed outer quote is reported as a format issue.
What is the difference between ${VAR:-default} and ${VAR-default}?
The hint for :- says the default applies when VAR is unset or empty. The hint for - says the default applies only when VAR is unset, so an empty value is retained. The tool reports these rules but does not resolve the expression.
Is it safe to paste an API key into an online env validator?
This page processes input in the browser by default and does not upload, URL-encode, or store the text. It masks values in the interface and provides a key-only export. For maximum caution, use example values or run the page in a trusted local environment.
Which framework presets are available?
The selector provides Node, React, Next, Vue, and Docker guidance. The preset changes the compatibility note; it does not rewrite keys, validate application-specific values, or evaluate framework configuration.