Dev TooloraLocal dev tools

> Config & Secrets

.env Validator

Check dotenv syntax, duplicate names and common assignment mistakes.

Runs locallyWorks offline
Back to results
Input

Source data

Output

Result

Your result will appear here.

Tool guide

About this tool.

  • Validation checks whether assignments fit this parser and whether names are repeated. It reports all detected line issues rather than stopping at the first.
  • Values remain strings. A syntactically valid PORT=hello is not proof that an application accepts that port.
  • No values are resolved or executed. This is not a schema validator, connectivity test or secret scanner.

  • Find malformed assignments, invalid names and missing closing quotes.
  • Locate duplicate variables before deployment.
  • Check the supported syntax before formatting or redacting.

Paste the complete file and run validation.

Read Valid/Invalid and each diagnostic line number.

Correct the source and run again; invalid lines are never rewritten for you.

Copy or download the diagnostic report. It may include variable names, but not assignment values.

  • PORT=3000 → Valid .env with Variables: 1.
  • EMPTY= → Valid .env; an empty value is allowed.
  • BAD-NAME=x → Line 1: Invalid variable name "BAD-NAME".
  • PORT=3000 then PORT=4000 → Line 2: Duplicate variable "PORT" (first declared on line 1).
  • TOKEN="unfinished → Line 1: Unterminated quoted value.
  • URL=${BASE_URL} → Valid .env, even when BASE_URL is not defined.

  • The report lists the first 20 issues and counts the rest.
  • This parser supports single-line KEY=value assignments, quotes, comments and optional export. Multiline values and shell execution are unsupported.
  • Names must begin with an ASCII letter or underscore and contain only ASCII letters, digits and underscores. Names are case-sensitive.
  • Unquoted # starts a comment, even without a space. Quote literal hashes such as URL fragments.
  • Variable references such as ${BASE_URL} remain literal; no environment lookup, interpolation or escape decoding occurs.
  • CRLF and CR become LF; an initial BOM is removed. Order, grouping and terminal newline are retained unless comments are explicitly removed.
  • Input is limited to 1,048,576 UTF-16 characters. Duplicate names are reported as issues, not silently overridden.
  • Validity applies only to this supported syntax, not every dotenv loader or your application schema.
  • Variables counts distinct names and Assignments counts assignment lines. In a valid report they are equal, because a repeated name makes the file invalid.
  • Diagnostic text can contain an invalid variable-name fragment; review it before sharing.

FAQ

Questions about .env Validator

What does the .env validator check?

Each line must be blank, a # comment or a KEY=value assignment with an optional export prefix. It reports invalid names, missing =, unterminated quotes, text after a closing quote and duplicate names, each with a line number.

Why is a duplicate variable reported as an error?

Loaders disagree about whether the first or the last value wins, so a repeated name is ambiguous. The validator reports the later line and names the line of the first declaration.

Does it check that my values are correct for the app?

No. Values are plain strings, so PORT=hello is valid syntax. Required variables, value types, URLs and whether ${VAR} references are defined are not checked.

Which characters can a variable name contain?

ASCII letters, digits and underscores, starting with a letter or an underscore. Names are case-sensitive, so Port and PORT are different variables, and BAD-NAME is invalid.

Does the validation report include my secret values?

No. Diagnostics give the line number and, for name or duplicate issues, the variable name, but assignment values are never repeated in the report.

Continue with

.env FormatterClean common dotenv syntax while preserving order, comments and grouping.Secret RedactorMask sensitive dotenv values before sharing configuration files.JSON FormatFormat, minify or validate JSON without rounding numbers, rewriting strings or dropping duplicate keys.