Environment Variables Validator

Validate .env files for syntax errors, duplicate keys, missing quotes, and compare against .env.example templates.

About This Tool

The Environment Variables Validator is a free, browser-based tool that helps developers catch common mistakes in .env files before they cause runtime errors. Whether you're setting up a new project, debugging a deployment, or reviewing a teammate's configuration, this tool gives you instant feedback on potential issues.

All processing happens entirely in your browser. Your environment variables, API keys, database credentials, and other sensitive data never leave your machine. There are no server requests, no logging, and no third-party analytics on your input.

The validator performs 10 different checks across three severity levels. Errors flag issues that will almost certainly cause problems, such as syntax errors or unmatched quotes. Warnings highlight potential issues like duplicate keys or trailing whitespace that may cause subtle bugs. Info messages note findings like empty values or variable references that are worth reviewing but may be intentional.

The comparison mode is especially useful for teams. Paste your .env.example template alongside your .env file to instantly see which required variables are missing, which extra variables you've added, and which keys match between the two files. This catches the most common cause of "works on my machine" problems: missing or misnamed environment variables.

How to Use

  1. Paste your .env file content into the main textarea on the left, or click Sample .env to load an example with intentional issues.
  2. Click Validate (or press Ctrl+Enter) to run all validation checks.
  3. Review the summary bar showing total variables, errors, warnings, and info messages.
  4. Scroll through the issues list to see detailed messages with line numbers and severity badges.
  5. To compare against a template, click Compare to enable comparison mode, then paste your .env.example content in the right textarea.
  6. Click Copy Results (or press Ctrl+Shift+C) to copy the full validation report to your clipboard.

FAQ

Is my .env data safe when using this tool?

Yes, completely. All validation and comparison is performed entirely in your browser using JavaScript. No data is sent to any server, no cookies are set, and no input is logged. This makes it safe for validating .env files that contain API keys, database credentials, and other sensitive secrets.

What types of issues does the validator detect?

The validator checks for 10 categories of issues: syntax errors (missing = sign), duplicate keys, missing quotes around values with spaces, unmatched quotes, invalid key characters, empty values, inline comments without proper spacing, variable references ($VAR or ${VAR}), trailing whitespace, and BOM (Byte Order Mark) characters.

What does comparison mode do?

Comparison mode lets you paste a .env.example template alongside your .env file. It identifies keys that are missing from your .env (required by the template), extra keys not in the template, and keys that are present in both files. This helps ensure your environment is properly configured.

What severity levels are used?

Issues are categorized into three severity levels: Error (red) for problems that will likely cause failures, like syntax errors or unmatched quotes; Warning (yellow) for potential issues like duplicate keys or trailing whitespace; and Info (blue) for informational findings like empty values or variable references.

Does it support comments in .env files?

Yes. Lines starting with # are treated as comments and are skipped during validation. The validator also detects inline comments (text after # within a value line) and warns you about them, since some .env parsers don't support inline comments.

What key naming conventions does it check?

Keys must contain only letters, numbers, and underscores, and must start with a letter or underscore. Keys that aren't in UPPER_SNAKE_CASE will generate a convention warning, since uppercase naming is the widely accepted standard for environment variables.

Can I use keyboard shortcuts?

Yes. Press Ctrl+Enter (or Cmd+Enter on Mac) to run validation, and Ctrl+Shift+C (or Cmd+Shift+C) to copy the validation results to your clipboard.

Related Tools