.env · debug🔥 popular🔒 100% client-side — never leaves your browser

ENV Diff Checker: compare two .env files

Compare two .env files side by side: this ENV diff checker lists keys that were added, removed or changed between file A and file B, and produces a masked report you can share without exposing secret values.

By Aliniyaz Mamat · last reviewed

Be the first to rate
Added1
NEW_KEY
••••••••
Removed1
OLD_KEY
••••••••
Changed3
DATABASE_URL
pos•••••••• → pos••••••••
PORT
•••••••• → ••••••••
DEBUG
•••••••• → ••••••••

Key takeaways

  • ✓Keys are compared by parsed value, so KEY=abc and KEY="abc" count as equal; quoting and comments don't create false alarms.
  • ✓Masked output hides values completely: no length, no last characters. Values of 16+ characters keep a 3-character prefix, enough to spot sk_test vs sk_live.
  • ✓Order doesn't matter: a key that moved but kept its value is unchanged.
  • ✓If a key is defined twice in one file, the last definition counts, as in dotenv.

What it does

  • ▸Added, removed and changed keys at a glance
  • ▸Compares parsed values, ignoring quotes, comments and order
  • ▸Masked diff report, safe to paste into a ticket or PR
  • ▸Reveal values when you need them, locally
  • ▸100% client-side

Privacy

Runs 100% in your browser. Your .env never touches our servers.

client-side only

Example

Case 1 · Masked report
# A: staging
STRIPE_SECRET_KEY=sk_test_51Habc…
LOG_LEVEL=debug
# B: production
STRIPE_SECRET_KEY=sk_live_51Hxyz…
SENTRY_DSN=https://…
# + Added
+ SENTRY_DSN=htt••••••••

# - Removed
- LOG_LEVEL=••••••••

# ~ Changed
- STRIPE_SECRET_KEY=sk_••••••••
+ STRIPE_SECRET_KEY=sk_••••••••

When to use this tool

  • →Checking staging against production before a release
  • →Reviewing a PR that changes .env.example
  • →Finding the one variable that differs on a teammate's machine
  • →Documenting configuration changes in a change log without leaking secrets

Common mistakes

  • ⚠Pasting a revealed diff into chat. Keep the mask on whenever the report leaves your screen
  • ⚠Comparing against a stale copy of production. Export the current values from the host first
  • ⚠Reading "removed" as harmless: a key missing in production is the classic cause of a crash at startup
  • ⚠Ignoring changed values that look alike, e.g. a trailing slash in API_URL

What the diff compares

RowMeaningTypical cause
+ Addedkey exists only in Bnew feature or service configured in B
- Removedkey exists only in Aforgotten variable on a new server
~ Changedkey in both, different valuedifferent credentials, URLs or flags
unchanged (count)same key, same valueshared defaults

Both files are parsed before comparing: quotes, inline comments, export and line order are ignored, so the diff only shows what a dotenv loader would actually see. To check one file for syntax problems first, use the .env validator.

Comparing environments safely

  1. Export the current values: vercel env pull .env.prod --environment=production, heroku config -s > .env.prod, or kubectl get secret app-env -o json decoded with the ENV to base64 tool.
  2. Paste staging as A and production as B. Keep mask values on.
  3. Treat every removed row as a deploy blocker unless you know the key is obsolete.
  4. Delete the exported file afterwards; it is a full copy of production secrets.

To check only for missing keys against your template, the missing env detector is quicker. To combine files instead of comparing them, use the ENV merger.

Diffing .env files on the command line

# keys only (no values printed): what is in A but not in B, and vice versa
diff <(grep -oE '^[A-Za-z_][A-Za-z0-9_]*' .env.staging | sort -u) \
     <(grep -oE '^[A-Za-z_][A-Za-z0-9_]*' .env.production | sort -u)

# git: compare the template between two branches
git diff main..feature -- .env.example

The key-only diff is safe for CI logs. Never print full diff output of real .env files in a pipeline: logs are often visible to more people than the secrets are.

Frequently asked questions

Does the diff show my secret values?

Not by default. Values are replaced by ••••••••, without revealing their length; long values keep only their first 3 characters. Untick mask values to see them locally.

Which file wins when both define the same key?

Neither. The diff shows the key as changed with both (masked) values. You decide which one is correct.

Are quoted and unquoted values treated as different?

No. KEY=abc, KEY="abc" and KEY='abc' all parse to abc and count as unchanged.

What does removed mean compared to changed?

Removed: the key exists in A but not in B. Changed: it exists in both, with different values. Removed keys usually break deployments; changed keys may be intentional.

Is anything uploaded?

No. Both files are parsed and compared in your browser.

Related tools

Learn more

coming soon

Get notified when env syncing launches

We're building a tiny tool to keep .env files in sync across teammates and environments. Leave your email — no spam, just a single launch ping.

We use your address only for this launch email. You can ask us to delete it at any time. Privacy policy