What is .env File Validator?
A .env (dotenv) file stores environment variables as KEY=VALUE pairs, loaded at runtime to configure applications without hardcoding secrets in source code. Invalid formatting — duplicate keys, missing values, or invalid key names — can cause subtle bugs that are hard to trace. This validator catches those issues instantly.
How to Use
- Paste your .env file content into the top editor.
- Optionally paste your .env.example file to check for missing keys.
- Click "Validate" to see all issues with line numbers.
- Errors (red) are definite problems; warnings (yellow) are potential issues.
- Fix each issue in your actual .env file and re-validate.
Why Use This Tool?
Tips & Best Practices
- Key names should use UPPER_CASE with underscores by convention
- Quote values that contain spaces: MY_VAR="hello world"
- Inline comments can break some parsers — use a separate comment line instead
- Never commit your actual .env file; always commit .env.example with placeholder values
- Use different .env files per environment: .env.local, .env.production, .env.test
Frequently Asked Questions
Why does my .env file cause bugs in production?
Common causes: duplicate keys (last value wins in most parsers but first in others), missing quotes around values with special characters, empty required values, or keys present in .env.example but missing from the deployed .env file. Run this validator before every deployment.
Are my .env file contents safe to paste here?
Yes. All validation runs entirely in your browser using JavaScript. Your .env contents never leave your device and are not sent to any server. You can verify this by checking the browser network tab.
What is .env.example for?
.env.example (also called .env.template or .env.sample) is a version-controlled file listing all required environment variable names with placeholder or example values. It documents the variables needed to run the app without exposing real secrets. New developers copy it to .env and fill in real values.
Can I have comments in .env files?
Yes. Lines starting with # are treated as comments and ignored by dotenv parsers. Inline comments (VALUE=something # note) are risky — some parsers include the "# note" as part of the value. It's safer to put comments on their own line.