Next.js .env Generator

Generate a Next.js .env.local with a secure NEXTAUTH_SECRET, DATABASE_URL and public variables.

🔒 100% client-side. Your keys, secrets and values are never sent to any server and never stored.

.env

.env.example (secrets removed)

Input

Output

Paste your .env content

Next.js environment files

Next.js loads .env.local for secrets and .env for defaults. Only variables prefixed with NEXT_PUBLIC_ are exposed to the browser, so never put secrets behind that prefix.

Generate NEXTAUTH_SECRET

The template creates a random 48-byte Base64 NEXTAUTH_SECRET for Auth.js / NextAuth. Use the Regenerate button for a new value and copy the .env.example for your repo.

Frequently asked questions

Which file should I use, .env or .env.local?

Use .env.local for real secrets (it is ignored by Git by default) and .env for non-sensitive defaults.

How long should NEXTAUTH_SECRET be?

At least 32 random bytes. The generated Base64 value meets that.