.env File Validator

Check a .env file for dotenv syntax errors, duplicate keys, quoting traps and missing variables.

Checks (3 on)

Paste a .env file above to check its syntax, spot duplicate keys and see exactly what a loader will read.

No uploads. Your files stay on your device.

Free forever, no sign-up, no cookies. Buy me a coffee

How it works

This validator parses your file with the same rules as dotenv v16 (motdotla/dotenv), the parser behind Node, Next.js, Vite and most framework .env support. Every line that is not blank or a # comment must be KEY=VALUE, with an optional export prefix. Values may be bare or wrapped in single quotes, double quotes or backticks, and quoted values may span several lines. In an unquoted value everything from the first # onward is dropped as a comment, so URL=http://x/#top silently loses its fragment: quote it to keep it. Inside double quotes \n and \r become real newlines; inside single quotes they stay literal. dotenv does not unescape \", so that backslash survives into the value, and the validator flags it.

On top of syntax it reports duplicate keys (the later line wins), keys a POSIX shell cannot export because of dots, dashes or a leading digit, whitespace around the =, unterminated quotes, empty values, references to a variable that no earlier line defines, and values that look like real credentials rather than placeholders. The cleaned output re-quotes every value the minimal safe way, so it round-trips back through dotenv unchanged.

Everything is parsed by JavaScript in your own browser: nothing is uploaded, so it is safe to paste production configuration. Other loaders differ in the details, and python-dotenv and Docker Compose treat quotes and inline comments slightly differently, so read the quoting warnings as portability advice rather than pure style.

Frequently asked questions

What counts as a valid .env file?

Every line must be blank, a # comment, or a KEY=VALUE assignment with an optional export prefix. Keys should be UPPER_SNAKE_CASE so a shell can export them, and values may be bare or wrapped in single quotes, double quotes or backticks, with quoted values allowed to span several lines. This validator applies the same rules as dotenv v16, the parser behind Node, Next.js and Vite, and reports the line number of anything that does not fit.

Why did part of my .env value disappear after a # sign?

In an unquoted value dotenv treats the first # as the start of a comment and drops everything after it, so PASSWORD=abc#123 loads as abc and URL=http://site/#top loses its fragment. Wrapping the value in single quotes keeps the # intact. The validator flags every line where a # was stripped so you can spot the truncated value before it reaches production.

Is my .env file uploaded anywhere?

No. The parser is JavaScript that runs in your own browser, so the file never leaves your device and no request carries its contents. That is why this page can be used on real configuration, though it is still good practice to keep secrets out of anything you paste into a browser tab and to make sure the file is listed in .gitignore.

Report a bug