ENV guide
How to Compare .env and .env.example Files
A real .env file contains local values. A committed .env.example should contain the same required keys, useful comments, and no credentials. Comparing them catches setup drift before it blocks another developer or deployment.
Give each file one job
Use .env for machine-specific values and keep it out of version control. Use .env.example as the public contract: it tells people which variables exist without distributing working secrets.
The key sets should normally match, but the values should not. A template may use empty values or safe placeholders where the expected format needs explanation.
.env DATABASE_URL=postgres://user:secret@localhost/app PORT=3000 .env.example DATABASE_URL= PORT=3000
Compare keys before values
Start by finding keys present in only one file. A key missing from .env.example leaves new contributors without setup guidance. A key missing from .env may cause a runtime failure or silently select an unsafe default.
Then review changed values only where consistency matters. Ports or feature flags may intentionally differ, while variable names and required presence should remain stable.
- Add undocumented application variables to .env.example without copying their values.
- Add missing local values through your normal secret-management process.
- Remove obsolete keys only after confirming the application no longer reads them.
Generate, review, and automate
EnvSift can generate a value-free template from a working file, but review comments because humans sometimes paste secrets into them. Commit the reviewed template, never the source .env file.
In CI, compare the set of required keys from the application or .env.example with the deployment configuration. Fail on missing required keys, but allow environment-specific extras when they are intentional.
Apply the guide privately
EnvSift processes ENV content locally in your browser and does not send keys or values to a server.
Compare your ENV files