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

Random Token Generator

Generate cryptographically secure opaque auth tokens, Bearer tokens, CSRF tokens, session IDs, and URL-safe verification tokens locally in your browser using the Web Crypto API.

High-entropy opaque bearer token safe for Authorization headers; store only its SHA-256 hash in your database.

Estimated entropy: 256 bits · 32 random bytes (base64url)~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 random tokens

Strong256 bits
Strong256 bits
Strong256 bits
Strong256 bits
Strong256 bits
Strong256 bits
Click any value to copy · R regenerates6 random tokens · local-only
random tokens

Generate Cryptographic Tokens in Your Backend

Python stdlib URL-safe token (256 bits)

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

Node.js URL-safe token (256 bits)

$node -e "console.log(require('crypto').randomBytes(32).toString('base64url'))"
token-store.ts
import { randomBytes, createHash, timingSafeEqual } from 'node:crypto'

export function issueOpaqueToken(prefix = 'tok_') {
  const token = prefix + randomBytes(32).toString('base64url')
  const tokenHash = createHash('sha256').update(token).digest('hex')
  // Return `token` to the client ONCE; persist only `tokenHash` + expiresAt in DB
  return { token, tokenHash }
}

export function verifyOpaqueToken(presented: string, storedHashHex: string): boolean {
  const candidate = createHash('sha256').update(presented).digest()
  const expected = Buffer.from(storedHashHex, 'hex')
  return candidate.length === expected.length && timingSafeEqual(candidate, expected)
}

Related Auth & Token Tools

Best practice: store a SHA-256 hash of every auth token

Treat opaque auth, bearer, and password-reset tokens like passwords in your database: show the raw token to the user once, and store SHA-256(token) server-side (high-entropy 256-bit random tokens do not need slow KDFs like bcrypt—fast SHA-256 lookup is safe and prevents database leaks from exposing active sessions).