Env Diff
BetaCompare two .env files by key and see which variables were added, removed or changed. Secret-looking values are masked by default. Runs in your browser; the files are not uploaded.
- Free, no sign-up
- Updated
- Reviewed by Olgun Ozoktas
Keys are matched by name after the dotenv rules are applied, so key order, quoting style and export prefixes never count as a change. Masking goes by key name: a key containing SECRET, TOKEN, PASSWORD, KEY, AUTH, PRIVATE, CREDENTIAL, SALT, DSN, COOKIE or SESSION is hidden.
Add two .env files, then press Compare
Paste or drop the older or template file on the left and the file to check on the right, for example .env.example and .env, or staging and production. Load sample shows every kind of difference.
Report
The report and both downloads use the same masking as the screen.
Runs in your browser; the files are not uploaded. Analytics and ads may load on the page.
Why Use Env Diff?
Env Diff compares two dotenv files by key. Each side is parsed the way a dotenv loader reads it: blank lines and # comment lines are skipped, a leading export is removed, single, double and backtick quotes are unwrapped, backslash escapes such as \n are decoded inside double quotes, a double-quoted value may span several lines, and an inline # comment after an unquoted value is cut off. The values are then compared as plain strings, key by key, so the order of the keys and the quoting style never produce a difference on their own.
The result has three kinds of difference. A key found only in File B is added, a key found only in File A is removed, and a key found in both with a different value is changed, shown as old value, arrow, new value. Keys with the same value are counted as unchanged and listed only when Show unchanged keys is on. The list follows File A's key order, then the keys that exist only in File B. A key defined twice in one file keeps its last value, and a warning names every line it was on.
Values whose key name contains SECRET, TOKEN, PASSWORD, PASSWD, PWD, KEY, AUTH, PRIVATE, CREDENTIAL, SALT, DSN, COOKIE or SESSION, in any letter case, are masked by default. A masked value is replaced by up to eight dots and its length. Mask all values hides every value, and Show all values hides nothing. The copied report and the .txt and .json downloads carry the same masking as the screen. A line with no = sign, a key name dotenv does not accept, or a quote that never closes stops the comparison with a message naming the file and the line, instead of guessing a key.
Env Diff never expands ${VAR} references, never runs a command, and is not a secrets manager: it compares the two texts you give it. To combine the files, use Env Merge. To convert one into JSON or YAML, use the Env JSON Converter or the Env YAML Converter.
How it compares
A text diff such as Diff Checker compares two .env files line by line, so a reordered file, a switch from single to double quotes or a moved comment looks like a change. Env Diff compares the parsed keys and values instead, and reports each missing or changed key once. For structured config formats the same idea applies in JSON Diff and TOML Diff. Unlike an online converter that posts your file to a server, this page parses both files in your browser.
Tips for Comparing .env Files
- Values are compared after the dotenv rules are applied, so APP_NAME="My App" and APP_NAME='My App' are the same value, and an inline # comment after an unquoted value is not part of it.
- The default mask goes by key name, and also hides the password inside a connection URL such as postgres://app:password@db/app under any key. Other secrets under an innocent-looking key stay visible, so choose Mask all values before you share a screenshot.
- A masked value keeps its length, for example ••••••••, 18 chars, so a changed secret still shows as changed.
- If a key appears twice in one file, the last value is used, which is what dotenv loaders do, and the warning names both lines.
- To combine the two files instead of comparing them, use Env Merge; to check one file for mistakes, use Env Linter.