.env Validator & Diff
Validate a .env file's syntax (catches missing equals signs, unquoted multi-word values, duplicate keys), or diff two .env files to spot drift between dev and prod environments.
How to use the .env Validator & Diff
Validate: paste your .env. The tool reports duplicate keys, lines missing =, unquoted values that contain spaces (often a bug), and keys with empty values. Diff: paste two .env files — typically your .env.example and your local .env — and see which keys are missing from each.
Validating and diffing .env files
The classic .env failure is not a syntax error — it is drift. A new key gets added to .env.example but not to someone’s local .env, or to dev but not prod, and the app crashes at runtime with a missing variable that nobody changed. Catching that means comparing two files key by key, not just checking that one is well-formed.
This does both: it validates a single .env for the usual problems (duplicate keys, lines missing =, unquoted multi-word values, empty values), and it diffs two files — typically .env.example against your local .env — to list the keys present in one but not the other. The diff is the part that catches environment drift; for a stricter single-file lint aimed at cross-loader portability, the .env validator (strict) goes deeper, and keep every .env out of version control with the .gitignore generator.
Common use cases
- Catch drift — find keys in .env.example missing from a local or prod .env.
- Onboarding — confirm a new clone has every variable the example lists.
- Pre-deploy check — compare staging and production env files before shipping.
- Quick lint — spot duplicate keys and missing = signs in one file.
- Audit — verify two environments declare the same configuration surface.