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

.env Validator: check a .env file for errors

Validate a .env file online: this .env validator finds syntax errors (missing =, invalid key names, unterminated quotes), duplicate and empty keys, and portability problems that only break in production, such as an unquoted # or spaces around =.

By Aliniyaz Mamat · last reviewed

Be the first to rate
live
7 lines · 3 errors · 2 warnings · 0 notes
2
valid
2
warnings
3
errors
line 6·Invalid key name "1INVALID_KEY". Must match [A-Za-z_][A-Za-z0-9_]*
line 7·Missing "=" on line 7
line 8·Unterminated double quote in "OPENAI_API_KEY"
line 3·Empty value for "JWT_SECRET"
line 5·Duplicate key "API_KEY" (first defined on line 4)

Key takeaways

  • ✓Errors stop a key from loading: missing =, names like 2FA_KEY or MY-KEY, an opening quote without a closing one.
  • ✓Warnings load but behave differently between tools: unquoted # (Node's dotenv cuts the value there), KEY = value (Docker rejects it), duplicates, empty values, placeholders like changeme.
  • ✓Notes flag things worth a look: inline comments, $ that may be expanded, lower-case names.
  • ✓Supports export KEY=value, single and double quotes, escaped quotes and inline comments.
  • ✓Runs in your browser; the file is never uploaded.

What it does

  • ▸Syntax errors with line numbers
  • ▸Duplicate, empty and placeholder value detection
  • ▸Portability checks for dotenv (Node, Python), Docker and shells
  • ▸Separate errors, warnings and notes
  • ▸100% client-side

Privacy

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

client-side only

Usage examples

Case 1 · Errors
DATABASE_URL postgres://db/app
2FA_SECRET=abc
TITLE="Hello
line 1 · Missing "=" on line 1
line 2 · Invalid key name "2FA_SECRET"
line 3 · Unterminated double quote in "TITLE"
Case 2 · Silent problems
DB_PASSWORD=ab#cd
API_URL = https://api.example.com
JWT_SECRET=changeme
line 1 · Unquoted "#" in "DB_PASSWORD" …
line 2 · Spaces around "=" in "API_URL" …
line 3 · "JWT_SECRET" looks like a placeholder …

When to use this tool

  • →A deploy fails with undefined env variables and you need to know why
  • →Reviewing a .env before sending it to a host or a teammate
  • →Checking .env.example in a pull request
  • →Moving a file between Node.js, Python and Docker and wanting it to work in all three

Common mistakes

  • ⚠Fixing only errors: warnings like an unquoted # silently change values without any error at runtime
  • ⚠Validating a different file than the one the app loads (.env vs .env.local vs .env.production)
  • ⚠Assuming a valid file is complete. Missing keys need the missing env detector
  • ⚠Pasting production secrets into random online validators that upload them. This one does not; check the Network tab if unsure

Every check, and why it matters

CheckLevelWhat goes wrong otherwise
Missing =errorthe line is ignored, the variable is undefined
Invalid key name (digit first, -, ., spaces)errormost loaders skip it; shells can't export it
Unterminated quoteerrorthe value is lost or swallows following lines
Duplicate keywarningone definition silently wins (the last one in dotenv)
Empty valuewarningKEY= is set but empty, often a forgotten secret
Unquoted #warningNode's dotenv reads ab#cd as ab
Spaces around =warningdocker run --env-file rejects the name
Placeholder valuewarningchangeme, xxx, your_key_here reach production
UTF-8 BOMwarningfirst key name gets an invisible character in some tools
Inline comment, $, lower-case keynotebehaviour differs between loaders

The .env syntax that works everywhere

.env
# comments on their own line
DATABASE_URL=postgres://app:secret@db:5432/app
APP_NAME="Acme Billing"          # double quotes for spaces
SMTP_PASSWORD='p@ss#w$rd'        # single quotes: no # cut, no $ expansion
PRIVATE_KEY="-----BEGIN KEY-----\nMIIE…\n-----END KEY-----"
FEATURE_FLAGS=search,billing     # lists as comma-separated strings
  • Names: A-Z, 0-9, _, not starting with a digit.
  • No spaces around =.
  • Quote anything with spaces, # or $; single quotes keep it fully literal.
  • Multi-line values: one line with \n escapes inside double quotes.

The guide how to fix .env errors walks through the runtime symptoms ("undefined", wrong value, works locally but not in production) and their causes.

Validating .env files in CI

To stop broken templates from being merged, lint .env.example in your pipeline. The open-source dotenv-linter covers most of the same checks:

# GitHub Actions / any CI
curl -sSfL https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s
./bin/dotenv-linter .env.example

At runtime, validate the variables your app needs with a schema (zod, envalid, pydantic-settings) so a missing key fails at startup, not on the first request. After validating, the .env formatter and ENV cleaner tidy the file.

Frequently asked questions

What does the .env validator check?

Syntax errors (missing =, invalid names, unterminated quotes), duplicate and empty keys, placeholder values, unquoted #, spaces around =, a BOM, and notes on inline comments, $ and lower-case names.

Why is an unquoted # a warning and not fine?

Loaders disagree. python-dotenv only treats # (with a space) as a comment, but Node's dotenv stops the value at the first #. Quoting the value makes every loader read the same thing.

Does it support export and quoted values?

Yes. export KEY=value, single quotes, double quotes, escaped quotes inside double quotes and inline comments after a value are all understood.

Is my .env file uploaded?

No. Validation runs in your browser. Nothing is sent, logged or stored.

How is this different from a linter in my editor?

It needs no install and explains each finding in plain language, which helps when debugging a deploy from any machine. For automated checks, add dotenv-linter to CI as shown above.

Related tools

Learn more

Compare

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