.env Validator & Environment Variable Comparator
Validate .env files, detect syntax errors, duplicate keys, empty values, potential secrets, compare environments, find missing variables, and review configuration drift.
⚠ Configured with warnings or secrets
DATABASE_URLPotential secret detected in 'DATABASE_URL' (Key Name Heuristic). Masked by default.
JWT_SECRETPotential secret detected in 'JWT_SECRET' (Key Name Heuristic). Masked by default.
SESSION_SECRETPotential secret detected in 'SESSION_SECRET' (Key Name Heuristic). Masked by default.
How to Use
1. What is a .env File and Why is it Used?
A .env file is a plain text configuration file containing key-value pairs that define operating system environment variables for software applications. Popularized by the Twelve-Factor App methodology, storing configuration in the environment decouples runtime credentials and host settings from application source code.
Modern backend and frontend runtimes (such as Node.js, Next.js, Python Django/FastAPI, Ruby on Rails, Go, and Docker) load .env files at boot time to initialize database connection pools, third-party API keys, port bindings, and logging levels.
2. Standard Dotenv Syntax Rules & Quoting Conventions
Standard keys use uppercase alphanumeric characters with underscores (e.g. DATABASE_URL). Starting with digits or hyphens is invalid.
Use double quotes for values containing spaces, newlines (\n), or hash symbols. Single quotes preserve literal strings without escape expansion.
Lines beginning with # and empty whitespace lines are treated as non-executing comments and ignored by dotenv loaders.
3. How to Validate a .env File Online
Follow these steps to validate your environment configuration:
- Select Validate Mode: Click 1. Validate .env in the mode selector.
- Paste or Upload: Paste your raw
.envtext or click Upload File. - Review Health Score: Check your Environment Health Score (0–100) and review syntax errors, duplicates, and empty variables.
- Fix Issues: Click View Line on any diagnostic card to jump directly to that line in the Monaco editor.
- Mask or Reveal: Toggle Reveal Secrets to inspect masked sensitive credentials in your current browser session.
4. How to Compare Two .env Files (Dev vs. Staging vs. Prod)
When deploying software across multiple lifecycle stages, configuration values inevitably diverge. In Compare Mode, ToolMono evaluates:
- Added Variables: Keys present in Environment B (e.g. Production) that do not exist in Environment A.
- Removed Variables: Deprecated keys lingering in Environment A that are missing in Environment B.
- Changed Variables: Keys present in both environments whose assigned values differ (with secret values masked).
- Environment Parity (%): Deterministic percentage of matching keys across both environments.
5. Auditing .env Against .env.example
Team projects typically maintain a .env.example file in Git to document all expected keys. If a developer introduces a new variable (such as STRIPE_WEBHOOK_SECRET) without adding it to the template or production environment, the deployed application may crash on startup. Auditing against .env.example catches missing keys instantly.
6. Duplicate Key & Invalid Variable Name Detection
Duplicate variable keys (e.g. defining PORT=3000 on line 2 and PORT=8080 on line 24) cause unpredictable runtime behavior depending on whether your dotenv loader overrides or preserves first occurrences. The validator flags all duplicate keys and links directly to both the first and duplicate line numbers.
7. Empty Value Handling & Quoting Diagnostics
Variables defined with empty values (API_KEY=) can lead to silent authentication failures in downstream SDKs. ToolMono flags empty variables as configurable warnings or errors and warns when unquoted values contain spaces that could truncate strings in shell environments.
8. Secret Detection Heuristics & Automatic Masking
Detects high-entropy tokens, JWTs, AWS access keys (AKIA...), GitHub tokens (ghp_...), and variable names containing SECRET, PASSWORD, or TOKEN.
All detected secrets are masked with bullets (sk-••••••••••••) in the UI, diff views, and export reports, preventing accidental screen sharing leaks.
9. Configuration Drift & Deterministic Parity Scoring
Environment Parity measures the degree of alignment between two configuration sets. A parity score of 100% indicates that both environments share identical variable keys and values. The tool calculates parity deterministically:
Parity Percentage = (Matching Keys / Total Unique Keys) * 100
11. Step-by-Step Practical Comparison Example
Comparing Development vs Production configurations:
PORT=3000 NODE_ENV=development API_URL=https://dev.api.com DEBUG=true
PORT=3000 NODE_ENV=production API_URL=https://api.com SENTRY_DSN=https://sentry.io
Comparison Result:
ADDED:SENTRY_DSNis configured only in Production.REMOVED:DEBUGexists in Dev but is absent in Production.CHANGED:NODE_ENVandAPI_URLdiffer between environments.UNCHANGED:PORT=3000matches identically.
12. Generating .env.example Templates & Sanitized Files
Creates a shareable template with empty values (KEY=) while preserving comments and structure.
Replaces detected secrets with REPLACE_ME, safe for documentation or bug reports.
13. Real-World DevOps & CI/CD Use Cases
Validate environment files before Docker build or Kubernetes rollout.
Ensure developers have all required variables configured locally.
Verify that no hardcoded production API keys are committed to Git.
14. Exporting Markdown & JSON Audit Reports
Export complete configuration reviews as structured JSON for automation pipelines or formatted Markdown for GitHub pull request summaries.
15. 100% Client-Side In-Browser Privacy Guarantee
All .env parsing, duplicate detection, comparison algorithms, secret masking, and report generators run entirely within your local browser memory using JavaScript. No environment variables, passwords, or secret tokens are ever transmitted to ToolMono servers.
16. Authoritative References & Specifications
Consult official documentation and standards on environment variables:
The Twelve-Factor App: III. Config
Authoritative methodology for storing configuration in the environment.
Motdotla Dotenv Specification & Repository
De facto reference standard for .env syntax and parsing conventions.
POSIX IEEE Std 1003.1: Environment Variables Specification
Official standard for operating system environment variable definitions and naming.
OWASP Secrets Management Cheat Sheet
Industry security standards for preventing credential leakage in configuration.
17. Frequently Asked Questions (20 FAQs)
Related Tools
Browse all toolsJSON Formatter
Free online JSON formatter, beautifier, and validator. Format, indent, minify, and inspect JSON with real-time syntax error detection in your browser. 100% client-side.
Free JSON Diff Checker
Compare two JSON files or objects online and find structural differences instantly. Detect added, removed, and modified values with nested key paths in your browser.
JSON Schema Validator
Validate JSON data against a JSON Schema online with detailed errors, JSON paths, draft detection, and browser-based processing.
OpenAPI Validator
Validate, lint, and audit OpenAPI 3.2, 3.1, 3.0 and Swagger 2.0 specifications in JSON or YAML. Detect syntax errors, broken $ref pointers, path issues, security vulnerabilities, and API design warnings in your browser.
GraphQL Playground
Test GraphQL APIs online with an interactive query editor, variables, headers, schema introspection, documentation explorer, response viewer, and GraphQL error debugging.
Webhook Tester
Generate a free temporary webhook URL to capture, inspect, and debug incoming HTTP payloads, headers, and JSON in real time. Replay requests instantly.
cURL to Code
Convert cURL commands and browser DevTools requests into clean, idiomatic code for JavaScript, Python, Node.js, Go, and PHP. 100% client-side with zero server uploads.