.env File Compare
Compare two .env files, such as yours and .env.example, to find missing, extra, empty, duplicated and different variables, with values masked.
How to compare two .env files
Paste both files
Usually your .env first and .env.example second.
Choose how values show
Masked by default, so secrets are not on screen.
Fix what is missing
Copy the missing names into the first file.
Worked example
This is what .env File Compare gives for its own sample values. Open the tool above and change anything to try your own.
.env (for example your local file)
API_URL=http://localhost:3000 DATABASE_URL=postgres://localhost/app STRIPE_KEY=sk_test_51Hx DEBUG=true DEBUG=false SENTRY_DSN=
.env.example (or the server's file)
API_URL= DATABASE_URL= STRIPE_KEY= REDIS_URL= SENTRY_DSN=
- Show values
- Masked
Result
- Missing from the first file
- REDIS_URL
- Only in the first file
- DEBUG
- Empty in the first file
- SENTRY_DSN
| Variable | Status | First file | Second file |
|---|---|---|---|
| DEBUG | Only in the first file | fa*se | |
| REDIS_URL | Missing from the first file | (empty) | |
| API_URL | Different values | ht********00 | (empty) |
| DATABASE_URL | Different values | po********pp | (empty) |
| STRIPE_KEY | Different values | sk********Hx | (empty) |
When to use .env File Compare
The app works locally but crashes on a server, and you suspect a missing environment variable.
A pull request adds new variables and you want to check that .env.example lists them all.
Tips for a better .env File Compare result
Put your real file first and the example second; the missing-from-the-first list is then exactly what you need to add.
Keep values masked when sharing your screen, and switch to full values only to compare two settings side by side.
.env File Compare: limits and what to check
References to other variables, such as a path built from HOME, are compared as text, so two files can look different but give the same value.
Multi-line values in double quotes are read only on one line, so keys after such a value may be misread.
About .env File Compare
Find out why an app works on one machine and not another. Variables are compared by name: missing from either file, empty, different or the same, with duplicates and unreadable lines pointed out. export prefixes, quotes and inline comments are handled the way dotenv does.
FAQs
Which value wins when a name is set twice?
The last one, in most dotenv loaders. Duplicates are listed so you can remove the one you did not mean.
Are the files sent anywhere?
No. They are compared in your browser, and values are masked on screen unless you choose to show them.
Can I compare a .env with a Kubernetes ConfigMap?
Convert the ConfigMap's data to NAME=value lines first, and then compare.