How do I validate a .env file online?
Paste your .env file and the tool checks for syntax errors, duplicate keys, naming convention violations, exposed secrets (passwords, API keys), and missing quotes. Use Compare mode to diff .env vs .env.example for missing or extra variables. Export a clean .env.example template. Everything runs in your browser.
DATABASE_URL=postgres://localhost/db API_KEY=sk-abc123 PORT=3000 DEBUG=true SECRET=
✓ 4 valid variables ⚠ 1 issue: SECRET — empty value (may cause runtime errors) Variables: 5 total Types: 2 URLs, 1 number, 1 boolean, 1 empty
.env File Validator
Validate .env files for syntax errors, duplicate keys, security risks, and best practices. Export a sanitized version or .env.example template.
About .env File Validation
A .env file stores environment variables as key-value pairs. They are used to configure applications without hardcoding sensitive data like API keys and database credentials.
What we check:
- Syntax— valid KEY=VALUE format, proper quoting, no spaces around "="
- Variable names — must match
[a-zA-Z_][a-zA-Z0-9_]* - Duplicate keys— flags variables defined more than once
- Empty values— warns about variables with no value assigned
- Placeholder values— detects TODO, changeme, and similar placeholders
- Security— flags real secrets in sensitive variables (passwords, tokens, API keys)
- Embedded credentials— warns about URLs containing username:password
- Inline comments— detects potential unquoted inline comments
Export options:
- .env.example— keys only, no values. Safe to commit to version control.
- Sanitized copy — all values replaced with
<REDACTED>for sharing without exposing secrets.
Everything runs in your browser — no data is sent over the network.
Tips & Best Practices
Compare .env against .env.example on every deploy
Your .env.example should list every variable your app needs (with empty or example values). Validate that production .env has all required keys before starting the app. Missing variables cause runtime crashes that are hard to debug.
Quoted and unquoted .env values behave differently
In most .env parsers, VALUE=hello world sets VALUE to 'hello world' (with space). But VALUE="hello world" includes the quotes in some parsers and strips them in others. Be consistent: always quote values containing spaces or special characters.
Use dotenv-vault or SOPS for team .env sharing
Sharing .env files via Slack, email, or git is insecure and error-prone. Tools like dotenv-vault encrypt .env files for safe version control, while SOPS (by Mozilla) encrypts individual values. Both support team key rotation.
Never commit .env files to git — add them to .gitignore immediately
Even private repos can be leaked, forked, or accessed by contractors. Committed .env files with API keys are the #1 cause of credential leaks in GitHub repos. If you accidentally committed one, rotate ALL the secrets — git history is permanent.
Frequently Asked Questions
How do I validate a .env file for errors?
What are common mistakes in .env files?
Should I commit .env files to Git?
Related Inspect Tools
File Hash Calculator
Compute MD5, SHA-1, SHA-256, SHA-384, SHA-512 file hashes — drag and drop to verify integrity with checksum comparison
LLM Token Counter
Count tokens and estimate API costs for GPT-4o, Claude, Gemini, and other LLMs with BPE tokenization
AI Model Comparison
Compare 23 AI models (Claude 4.6, GPT-4.1, Gemini 3) + 5 coding IDEs (Cursor, Copilot, Windsurf, Kiro, Antigravity) — pricing, context windows, capabilities
JSON Visualizer
Visualize JSON as an interactive tree — collapsible nodes, search, path copy, depth controls, and data statistics