⭐ 0

Duplicate Key Example: A Common .env File Error

Check a .env file for KEY=VALUE rows, duplicate keys, and quotes that open and do not close.

🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.

The result appears on this page after you run the tool. Nothing you enter is uploaded.

Processing... 0%
Parsing env variables
Verifying keys format
Checking values quotes
Checking duplicates
Compiling configuration

Result

About this tool

This page opens the ENV validator preloaded with a `.env` file where `PORT` is defined twice: once near the top set to `3000`, and again at the bottom set to `8080`. The validator reads the file top to bottom, tracks every key it has already seen, and flags the second occurrence the instant the page loads — pointing straight at the duplicate line.

Duplicate keys are one of the sneakiest classes of `.env` bugs because the file is still syntactically valid line by line — nothing about `PORT=8080` on its own is wrong. The danger is that most tools that load `.env` files (dotenv and its many equivalents) simply let the last occurrence silently win, so whichever value comes later overrides the earlier one with no warning at all. That's exactly the kind of mistake that creeps in when a config file grows over time, gets merged from two branches, or is assembled by copy-pasting blocks from another project.

Delete either `PORT` line in the box below to see the result flip back to valid, or paste in your own `.env` file to check it for the same kind of accidental duplicate.

Example. FOO=bar and BAR=baz pass with .env configuration syntax is valid! A second FOO=bar fails with Duplicate environment key: "FOO". export FOO=bar fails because the key is read as export FOO.

Limit. The scan does not strip export, does not expand variables, and does not join continued lines. A quote is only checked as a matching pair at the two ends of the value.