Skip to content
Esc
  • MQTT Topic MatcherTest MQTT topic filters with + and # wildcards against topics, and check ACL patterns.
  • JSON FormatterBeautify, minify and validate JSON instantly as you type.
  • JSON DiffCompare two JSON documents and see every added, removed and changed value by path.
  • JSON to TypeScriptGenerate TypeScript interfaces or Zod schemas from a sample JSON response.
  • Base64 Encoder/DecoderConvert text to Base64 and back, with full Unicode support.
  • UUID GeneratorGenerate random v4 UUIDs — one or many — in the format you need.
  • JWT DecoderDecode JSON Web Tokens to inspect the header, payload and expiry.
  • Timestamp ConverterConvert Unix timestamps to dates and dates to timestamps.
  • URL Encoder/DecoderPercent-encode and decode URLs, and break down query strings.
  • Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.
  • Regex TesterTest regular expressions with live match highlighting and groups.
  • YAML to JSON ConverterConvert YAML to JSON and JSON to YAML, with clear error locations.
  • SQL FormatterBeautify or minify SQL for PostgreSQL, MySQL, SQL Server and 9 more dialects.
  • Mock Data GeneratorGenerate realistic fake data for API mocks as JSON, CSV or SQL inserts.
  • HTTP Header AnalyzerGrade response headers: CSP, HSTS, cookies, CORS and caching, explained.
  • Webhook Signature VerifierVerify and generate webhook signatures for GitHub, Stripe, Slack, Shopify and more.
  • Cron Expression GeneratorBuild and explain cron schedules, with the next run times in any time zone.
  • .env File ValidatorFind syntax errors, duplicates and missing keys in .env files.
  • HTML to JSX ConverterConvert HTML to valid React JSX: className, style objects, self-closing tags.
  • SVG to React ComponentTurn SVG files into React icon components with props and currentColor.
  • Markdown EditorWrite Markdown with a live preview, GitHub tables and task lists, and HTML export.

↑ ↓ to moveEnter to openPaste data to open it in the right tool. Nothing leaves your browser.

.env File Validator

Paste a .env file to find syntax errors, duplicate keys and values that break in shells or Docker, and compare it with .env.example to catch missing variables.

Last updated

.env

.env.example

Problems

0 errors4 warnings2 notes
  • missingIn .env.example but not in .env: SENTRY_DSN
  • line 3warningSpaces around = in PORT. dotenv trims them, but sourcing the file in a shell fails.
  • line 6infoPUBLIC_URL refers to $BASE_URL, which isn't defined in this file (it must come from the environment).
  • line 7warningAPP_NAME contains spaces but isn't quoted. Quote it so shells and Docker read the same value.
  • line 10warningPORT is already defined on line 3. dotenv uses the later value; some tools keep the first. Remove one.
  • line 11warning"feature.search" contains . or -, which dotenv allows but shells and most platforms don't.
  • line 11infofeature.search isn't UPPER_SNAKE_CASE, the usual convention for environment variables.
  • extraIn .env but not documented in .env.example: PUBLIC_URLAPP_NAMELOG_LEVELfeature.search

Parsed variables (10)

2NODE_ENVpr••••••on
3PORT••••
4DATABASE_URLpo••••••••••••pp
5REDIS_URLre••••••••••••79
6PUBLIC_URL${•••••••••••pp
7APP_NAMEDe•••••••PI
8JWT_SECRETa-••••••••••••ng
9LOG_LEVEL••••
10PORT••••
11feature.search••••

.env.example

NODE_ENV=
PORT=
DATABASE_URL=
REDIS_URL=
PUBLIC_URL=
APP_NAME=
JWT_SECRET=
LOG_LEVEL=
feature.search=

Commit .env.example, never .env. It documents which variables exist without exposing any values.

How to use the .env File Validator

  1. Paste your .env

    Values are masked on screen by default, so you can paste a real file without shoulder-surfing worries.

  2. Add .env.example

    Optionally paste your .env.example to find variables you forgot to set.

  3. Fix the problems

    Each problem shows its line number, how serious it is and how to fix it.

  4. Generate .env.example

    Copy or download a .env.example with every key and no values, ready to commit.

Features

  • Parses like dotenv: export, comments, single, double and backtick quotes, multi-line values and inline # comments
  • Errors for invalid names, lines that aren't KEY=VALUE and unclosed quotes
  • Warnings for duplicates, spaces around =, unquoted spaces, trailing whitespace and KEY: value syntax
  • Compares with .env.example to list missing and undocumented variables
  • Flags ${VAR} references to variables that aren't defined in the file
  • Detects well-known credentials: AWS access keys, live Stripe keys, GitHub and Slack tokens, private keys
  • Masks values by default, with a Show values switch
  • Generates a .env.example with every key and no values

Privacy

Your .env file is parsed by JavaScript in your browser tab and never uploaded or stored. Values are masked on screen unless you switch on Show values.

Read the DevNest privacy policy

Examples

  • Spot problems in a .env

    Spaces around =, an unquoted value with spaces and a duplicate key.

    .env

    NODE_ENV=production
    PORT = 8080
    APP_NAME=Sensor Gateway
    API_URL=https://api.example.com
    PORT=3000

    Problems

    Line 2 [warning] Spaces around = in PORT. dotenv trims them, but sourcing the file in a shell fails.
    Line 3 [warning] APP_NAME contains spaces but isn't quoted. Quote it so shells and Docker read the same value.
    Line 5 [warning] PORT is already defined on line 2. dotenv uses the later value; some tools keep the first. Remove one.
  • Compare with .env.example

    Two variables from .env.example were never set.

    .env · .env.example

    DATABASE_URL=postgres://app@db:5432/app
    REDIS_URL=redis://cache:6379
    ---
    DATABASE_URL=
    REDIS_URL=
    JWT_SECRET=
    SENTRY_DSN=

    Problems

    Missing from .env: JWT_SECRET, SENTRY_DSN
  • References and multi-line values

    ${CDN_HOST} isn't defined in the file, and the key spans several lines.

    .env

    BASE_URL=https://example.com
    CALLBACK_URL=${BASE_URL}/auth/callback
    ASSETS_URL=${CDN_HOST}/static
    TLS_KEY="-----BEGIN PRIVATE KEY-----
    MIIEvQIBADANBg…
    -----END PRIVATE KEY-----"

    Problems

    Line 3 [info] ASSETS_URL refers to $CDN_HOST, which isn't defined in this file (it must come from the environment).
    Line 4 [info] TLS_KEY spans lines 4–6 (multi-line value).
    Line 4 [warning] TLS_KEY looks like a private key. Never commit this file, and rotate the credential if it was shared.

Understanding .env files

.env syntax

# Comments start with #
NODE_ENV=production
export PORT=8080
APP_NAME="DevNest API"     # quote values with spaces
GREETING='Hello $USER'      # single quotes: no expansion
PRIVATE_KEY="-----BEGIN KEY-----
...
-----END KEY-----"

Names should use letters, digits and underscores and not start with a digit; UPPER_SNAKE_CASE is the convention. Quote any value that contains spaces or #.

dotenv vs shells vs Docker

The same file is often read by several tools, and they don't agree on the details. dotenv libraries trim spaces around = and accept KEY: value, but source .env in a shell fails on both. Shells and most platforms reject names containing . or -. Duplicate keys resolve differently too. The validator flags anything that only works in some of them.

Keep secrets out of git

  • Add .env to .gitignore before the first commit.
  • Commit .env.example with every key and no values, so new developers know what to set.
  • If a real secret was ever committed, rotate it — deleting the file doesn't remove it from git history.
  • In production, prefer your platform's secret manager over a .env file on disk.

Frequently asked questions

Is it safe to paste a real .env file?

The file is processed only in your browser and nothing is sent or saved, and values are masked on screen by default. For extra safety, paste a copy with production secrets replaced.

Are spaces around the equals sign allowed?

dotenv libraries accept them, but shells don't: KEY = value makes source .env run a command called KEY. Write KEY=value to work everywhere.

What happens with duplicate keys?

Tools disagree: dotenv's parser keeps the later value, while some loaders keep the first. Keep each key once so every tool reads the same value.

Do I need quotes around values?

Only when a value contains spaces, a # or special characters, or spans several lines. Double quotes support escapes like \n; single quotes keep the text exactly as written.

What is .env.example for?

It lists every variable your app needs, without values, and is committed to git. New developers copy it to .env and fill it in, and this tool can compare the two to find missing keys.