RandomKeygen
Free · Private · Client-sideGenerated locally — never transmitted

Secret Key Generator

Generate cryptographically secure secrets for session management, API authentication, and other security-sensitive applications.

Estimated entropy: 256 bits · 32 random bytes~132,943,112,026,157,700,000,000,000,000 quintillion times the age of the universe to crack
Weak · <50 bitsFairGood · 70+Strong · 100+

In plain terms: a gaming PC guessing a million passwords per second would need 132,943,112,026,157,700,000,000,000,000,000,000 quintillion times the age of the universe. Even someone renting every cloud server on Earth — a trillion guesses per second — would need 132,943,112,026,157,700,000,000,000,000 quintillion times the age of the universe. Nobody is guessing this password; the only realistic risks are it being reused or phished.

Generated secrets

Strong256 bits
Strong256 bits
Strong256 bits
Strong256 bits
Strong256 bits
Click any value to copy · R regenerates5 secrets · local-only

Common Uses

.env
# Session secret
SESSION_SECRET=...

# Cookie signing secret
COOKIE_SECRET=...

# CSRF token secret
CSRF_SECRET=...
Express.js session
const session = require('express-session');

app.use(session({
  secret: process.env.SESSION_SECRET,
  resave: false,
  saveUninitialized: false,
  cookie: {
    secure: true,
    httpOnly: true,
    maxAge: 24 * 60 * 60 * 1000 // 24 hours
  }
}));

Choosing secret length

  • 128 bits (16 bytes): Minimum for most applications
  • 256 bits (32 bytes): Recommended for session secrets
  • 512 bits (64 bytes): Maximum security for sensitive operations

Bulk Generation

secrets

Generate in Terminal

Base64

$openssl rand -base64 32

Hexadecimal

$openssl rand -hex 32

URL-safe (Python)

$python3 -c "import secrets; print(secrets.token_urlsafe(32))"

Node.js

$node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

Only need the hex command? The openssl rand -hex 32 generator gives you 16, 32 or 64 random bytes as hex in your browser.

Seeding test accounts for your app as well? The username generator creates random handles in bulk.