</>DevTools

ENV.env Parser

Parse and edit .env files

.env File Complete Guide

.env Parser reads environment variable files (.env), visualizes them as a key-value table, and converts them to JSON. Use it to review project configuration with teammates, verify environment variable definitions, or convert between .env and JSON formats. Comments (#) and quoted values are handled automatically.

dotenv Syntax Rules

KEY=value Syntax

# Comments start with #
DATABASE_URL=postgres://localhost/mydb

# Values with spaces need quotes
APP_NAME="My Awesome App"

# Single quotes also work
SECRET_KEY='super-secret-value'

# Empty values are allowed
EMPTY_VAR=

# Numbers are stored as strings
PORT=3000

Environment Variable Priority (Next.js)

FilePriorityCommit to GitPurpose
.env.local1 (highest)NoLocal-only overrides
.env.development2YesDev defaults
.env.production2NoProduction settings
.env3 (lowest)YesShared defaults
.env.example-YesTeam onboarding template

Security — Git Exclusion and Secret Management

Never commit .env files containing API keys, database passwords, or JWT secrets to Git. Always add them to .gitignore:

# .gitignore
.env.local
.env.production
.env*.local

Commit a .env.example file with key names but no real values for team onboarding. For production, use a secrets manager like Vercel environment variables, AWS Secrets Manager, or Doppler.

Practical Example: Next.js Project Setup

# .env (shared, safe to commit)
NEXT_PUBLIC_APP_URL=https://example.com
NEXT_PUBLIC_GA_ID=G-XXXXXXXXXX

# .env.local (local only, never commit)
DATABASE_URL=postgres://localhost:5432/myapp_dev
NEXTAUTH_SECRET=your-local-secret-key
OPENAI_API_KEY=sk-...

Only variables prefixed with NEXT_PUBLIC_ are accessible on the client side. All others are server-side only.

🔗Related Tools🧰 Misc