Random Base64 Generator
About this tool
About Random Base64 Generator
Many tools ask for a random secret in Base64: NextAuth and Auth.js AUTH_SECRET, Rails and Laravel app keys, Kubernetes secrets, WireGuard-style keys and countless .env files. This generator takes cryptographically secure random bytes from your browser and encodes them as standard Base64 with = padding, the same output as openssl rand -base64, or as URL-safe Base64url without padding for JWTs, JWK files, query strings and HTTP headers. Choose 128 to 1024 bits; the panel shows the exact byte and character count (32 bytes become 44 Base64 characters, or 43 in Base64url). Generate up to 50 at once, and switch Output to .env line to get NAME=value lines to paste straight into a config file. Base64 packs more randomness into fewer characters than hex, so keys stay short. Everything is generated locally and nothing is sent or stored.
Built and maintained by Abhi JainUpdated
How to Generate Random Base64
- 1
Choose the size
Pick a Key size. 256-bit (32 bytes) suits most app secrets.
- 2
Choose the variant
Leave Encoding on Base64, or pick Base64url for URLs and JWTs.
- 3
Copy
Copy a value, Copy all, or Download the list.
Random Base64 Generator: questions and answers
Is this the same as openssl rand -base64 32?
Yes: 32 cryptographically random bytes encoded as 44 Base64 characters, ending in =. The bytes come from crypto.getRandomValues.
What is the difference between Base64 and Base64url?
Base64url replaces + with - and / with _ and drops the = padding, so the value can go in URLs, file names and JWTs without escaping. The random bytes are the same.
How long should a Base64 secret be?
At least 32 random bytes (256 bits), which is 44 characters of Base64. That is what openssl rand -base64 32, the command many framework docs suggest, produces.
Is the generated secret stored anywhere?
No. It exists only in this page until you close it.
More Secret Key Generator presets
Related tools
- Random String GeneratorRandom strings from preset or custom alphabets: letters, hex, Base58, URL-safe and more.
- Key Pair GeneratorEd25519, ECDSA and RSA key pairs in OpenSSH, PEM and JWK formats, generated in your browser.
- Password GeneratorStrong random passwords with a live strength and entropy estimate.
- Encrypt TextTurn a message into password-protected AES-256 ciphertext you can paste anywhere.