OpenSSL Rand Online
Equivalent OpenSSL command
openssl rand -hex 32Other Coding Tools
OpenSSL Rand Online for random keys and secrets
How do I run openssl rand -hex 32 online?
Open the generator and click Copy. It automatically generates 32 random bytes in hex, the same kind of output as openssl rand -hex 32, without a terminal or an OpenSSL installation. Click Regenerate for a new value, or change the byte count and format to see the corresponding OpenSSL command.
What does openssl rand -hex 32 output?
It generates 32 random bytes, or 256 bits, and displays them as 64 lowercase hex characters. Each byte takes two hex digits. Choose 16 bytes for openssl rand -hex 16 online (32 hex characters, 128 bits) or 64 bytes for openssl rand -hex 64 online (128 hex characters, 512 bits of random input).
What's the difference between Hex, Base64, and Base64url?
All three encode the same bytes. Hex uses 0-9 and a-f. Base64 uses a larger alphabet, including + and /, so the result is shorter. To generate openssl rand -base64 32 online, choose Base64 and 32 bytes for 44 characters. With openssl rand -base64 64, you get 88 characters. The generator puts them on one line for easy copying. OpenSSL may wrap longer Base64 output across lines. Base64url uses - and _ in place of + and / and omits the trailing = padding here, so 32 bytes become 43 characters.
How many bytes should a random secret key have?
Use the length and encoding required by your application. For example, AES-128 uses 16 key bytes, AES-256 uses 32, and HS256 JWT signing requires at least 32. For a general application secret with no specific requirement, 32 random bytes is a common choice. The bit count shown comes from the random bytes. The character count measures the encoded secret before any .env name or framework prefix.
How do I generate an Auth.js, JWT, or session secret online?
Choose Auth.js for AUTH_SECRET or enter NEXTAUTH_SECRET if your NextAuth.js configuration uses that name. NextAuth.js documents openssl rand -base64 32 as a way to create a secret. The JWT (HS256) preset generates JWT_SECRET in Base64url, and the Session preset generates a hex SESSION_SECRET. Your app must read the variable name you choose and handle the selected encoding. For Better Auth, use the Better Auth Secret Generator to copy BETTER_AUTH_SECRET directly. See the NextAuth.js configuration docs and JWT algorithm specification.
How do I generate a random string for my .env file?
Enter an environment variable name to copy the entire NAME=value line. The Rails preset creates a 64-byte hex SECRET_KEY_BASE. The Laravel (AES-256) preset creates APP_KEY=base64:… with the 32-byte key used by Laravel's default AES-256-CBC cipher. Keep secret values in your server environment or secret manager and out of version control.
How does this online random key generator protect my secrets?
Your browser creates the bytes locally using crypto.getRandomValues() from the Web Crypto API. The generated values stay in the page until you copy them. The URL shares only the byte count and format. For a Web Push public/private key pair, use the VAPID Key Generator. For passwords with specific character rules, use the Password Generator.