.env File Validator (Strict)
Paste a .env file, get a per-line validation report. Catches duplicate keys (a common source of mysterious bugs), values with characters that need quoting, comments not on their own line, malformed key names, and other issues that different .env loaders handle differently.
How to use the .env File Validator (Strict)
Paste a .env file. The validator reports each issue with its line number and severity. Most loaders (dotenv-js, python-dotenv, godotenv, Ruby dotenv) handle .env files slightly differently — this validator targets the strictest common subset so your file works everywhere.
Validating a .env file
A .env file looks trivial — KEY=value lines — but the loaders that read it disagree on the details. Some accept unquoted values with spaces, others truncate them; some take the first duplicate key, others the last; some allow inline comments, others treat the # as part of the value. A file that works in one stack can silently misbehave in another, and a duplicate key can quietly override a setting you thought was active.
This lints a pasted .env line by line against the strictest common subset of the popular loaders (dotenv-js, python-dotenv, godotenv, Ruby dotenv), flagging duplicate keys, values that need quoting, misplaced comments, and malformed names so the file behaves the same everywhere. It checks one file’s correctness; to compare two files and catch keys that drifted between environments, use the .env validator and diff, and keep the result out of Git with the .gitignore generator.
Common use cases
- Cross-loader safety — make a .env that behaves the same in Node, Python, Go, and Ruby.
- Catch duplicate keys — find the silently-overridden setting causing a mystery bug.
- Quoting check — flag values with spaces or special characters that need quotes.
- Pre-commit lint — validate the file before it reaches CI or a teammate.
- Onboarding — verify a handed-over .env is well-formed before trusting it.