.env File Diff & Compare
Compare two .env files to find missing keys, changed values, and extras. Includes a .env.example compliance check to catch missing keys before deployment.
What is a .env Diff Tool?
A .env diff tool compares two environment variable files side by side, highlighting keys that are missing, changed, or extra. In Laravel and most modern web frameworks, environment configuration lives in a .env file that is gitignored - meaning every developer and every deployment environment maintains its own copy. Drift between these copies causes hard-to-diagnose bugs: a service key present in development but missing in production, or a changed database URL that silently breaks migrations. This free online .env diff tool catches those mismatches instantly.
Two modes: Compare & .env.example Check
The Compare Two Files mode diffs any two .env files - useful for comparing staging versus production configs, or your local .env against a teammate's. The .env.example Check mode validates that your .env defines every key declared in .env.example - the standard Laravel approach to documenting required environment variables. Keys are colour-coded: red for missing (in .env.example but not your .env), amber for changed values, and blue for extra keys not declared in the example. Enable Mask values before taking screenshots or sharing diffs so secrets stay hidden.
Frequently Asked Questions
What is the purpose of .env.example in Laravel?
.env.example is a committed template that documents every environment variable the application needs, with placeholder (non-secret) values. New developers copy it to .env and fill in real values. It serves as the contract between your codebase and its configuration - if you add a new feature that requires a new variable, add it to .env.example so the team knows to set it. Use php artisan env:check or this tool to verify compliance before deploying.
Why does my app work locally but fail in production?
The most common cause is a missing or mismatched environment variable. Local development often has lenient defaults - Laravel silently falls back to null for unset variables - but production may require an explicit value. Check for: missing APP_KEY (causes decryption errors), wrong APP_URL (breaks asset URLs and redirects), missing queue or mail credentials, and mismatched DB_DATABASE. Paste both .env files into this tool to find the delta instantly.
Should I commit my .env file to git?
No. The .env file contains secrets - database passwords, API keys, encryption keys - that must never be committed to version control. Add .env to .gitignore (Laravel does this by default) and commit only .env.example with placeholder values. For production secrets, use a secrets manager (AWS Secrets Manager, HashiCorp Vault, Doppler) or your CI/CD platform's encrypted environment variables feature.
How do I access environment variables in Laravel?
Use the env('KEY', 'default') helper or the config() helper. The key difference: env() reads from the process environment at runtime; config() reads from cached config files. In production with php artisan config:cache, env() calls outside of config files return null - always read env values in config/*.php files and access them via config('app.name') in your application code.