Key and Token Generator
API Keys, Key Pairs, Secrets

Random keys from your browser's own cryptography. Make API keys and tokens, RSA, ECDSA, Ed25519, X25519 and secp256k1 key pairs as PEM, JWK and raw hex or Base64 with a fingerprint, Argon2id and bcrypt password hashes, JWT signing secrets and HTTP Basic Auth headers. Generated with WebCrypto and the open-source noble curves library. 100% client-side. Zero data stored.

Key and Token Generator illustration: a public key and a private key in PEM format, each under its BEGIN header, with a SHA-256 fingerprint line

Key and Token Generator Tool

Generated here, kept here

  • Tokens come from crypto.getRandomValues. Key pairs and HMAC secrets come from crypto.subtle.generateKey. Exports use crypto.subtle.exportKey and fingerprints use crypto.subtle.digest. These are the browser's WebCrypto functions; Math.random is never used.
  • Nothing is stored (no cookies, no localStorage, no URL) and nothing is sent: the page makes no network request with a key. Reloading the page erases everything.
  • Ed25519, X25519 and secp256k1 key pairs come from the open-source noble-curves library, and Argon2id hashes from hash-wasm, a WebAssembly build of Argon2. Both are served by this site, load only when you use them, run in your browser and never receive a key or password over the network.
  • Bcrypt hashes on the .htpasswd and bcrypt tab come from a small open-source JavaScript library (bcryptjs) that this site serves itself. It is loaded only when you open that tab, runs in your browser, and never receives your password over the network.
  • Treat keys made in any browser as development and test keys unless you trust this device, its extensions and everyone who can see the screen. Never paste a private key from here into a chat or a ticket.

Random tokens and API keys

Common Use Cases

API keys for a new service

Make a batch of prefixed, random keys for a test environment or a seed script, with a recognizable prefix so leaked keys are easy to spot.

Webhook signing secrets

Generate the shared secret a webhook sender and receiver use to sign and check payloads, as hex or Base64url.

JWT signing keys

Create an HS256 secret, or an RS256, PS256, ES256 or EdDSA key pair, in the PEM or JWK form your JWT library asks for.

Test fixtures

Produce throwaway key pairs for unit tests, mock identity providers and local development, without installing OpenSSL.

Basic Auth in curl, Postman and CI

Build the Authorization header for a staging site or an API, including user names and passwords with accents or symbols, and decode one you were given.

Compare public keys

Use the SHA-256 fingerprint to confirm that the public key you shared is the one that arrived, without reading a long PEM block aloud.

Key Reference

Which key type to choose
Type Used for Size Notes
ECDSA P-256JWT ES256, TLS and code signing256-bit curveSmall, fast, widely supported. A good default for signatures.
Ed25519EdDSA signatures, modern protocolsFixedFast and simple, but not every library or older system reads it.
X25519Key agreement (Diffie-Hellman), TLS 1.3, WireGuardFixedMakes a shared secret, not signatures. Keys are 32 random bytes, so raw hex and Base64 are shown too.
secp256k1Bitcoin, Ethereum, ES256K signatures256-bit curveThe curve behind most cryptocurrency wallets. Not a NIST curve, so WebCrypto does not offer it; the noble library makes it.
RSA 2048 or 3072JWT RS256 and PS256, legacy systems2048 minimumUniversal support, slower to generate and larger. Choose 3072 or more for long-lived keys.
RSA-OAEPEncrypting a small secret to a public key2048 minimumFor wrapping keys, not for signing and not for bulk data.
ECDHAgreeing a shared secret between two parties256-bit curveNever signs anything; the shared secret is then used with a cipher.
HMAC secretJWT HS256, HS384 and HS512, webhook signaturesAt least the hash sizeOne shared secret both sides must keep private; there is no public half.

PEM, PKCS#8 and SPKI

PEM is Base64 of the key's binary form inside BEGIN and END lines. A private key is exported as PKCS#8 (BEGIN PRIVATE KEY) and a public key as SPKI (BEGIN PUBLIC KEY), which are the formats most libraries and platforms read. Older RSA-only tools may want the PKCS#1 form (BEGIN RSA PRIVATE KEY); this tool does not write it.

The fingerprint

It is the SHA-256 hash of the public key's SPKI bytes, written as hex pairs. It is not the same value as an SSH fingerprint, which hashes a different encoding. Use it to check that two copies of a public key are identical.

How long a token should be

Aim for at least 128 bits of randomness, and 256 for anything long-lived. That is 32 hex characters, 22 Base64url characters or 22 alphanumeric characters at the very least; the tool shows the bits for what you choose. The prefix adds no security.

Basic Auth, briefly

The header is the word Basic, a space, and the Base64 of user:password. The first colon splits the two, so a user name cannot contain one but a password can. Over plain HTTP the password is readable by anyone on the path, so use HTTPS only.

JWT secrets and encodings

RFC 7518 asks for an HMAC key at least as long as the hash output: 256 bits for HS256, 384 for HS384 and 512 for HS512. Some libraries want the secret as text and others as bytes, so check whether yours expects the Base64url form, the hex form or the raw string.

bcrypt and .htpasswd, briefly

bcrypt adds a random salt and is deliberately slow: each step of cost doubles the work, so cost 12 takes four times as long as cost 10. It only reads the first 72 bytes of a password. An .htpasswd line is the user name, a colon and the hash, and Apache 2.4 reads the $2y$ form.

What this tool does not do

It does not write OpenSSH key files or X.509 certificates, it does not make apr1 (MD5) or {SHA} .htpasswd entries, and it does not import or convert existing keys. It also does not protect a key with a passphrase: the private key is shown unencrypted.

Frequently Asked Questions

Why We Built This Key and Token Generator

Setting up a webhook, a JWT login or a test database always begins the same way: you need a random secret, a key pair or a Basic Auth header, right now. The usual answers are an online generator that might log what it makes, or a command you have to look up again every time. Neither is a good place for a secret to start.

This tool does the job with the cryptography already inside your browser. Tokens come from the secure random generator, key pairs and HMAC secrets come from WebCrypto's own key generation, and the page tells you which function made each value. There is no hand-written cipher and no Math.random, and nothing is stored or sent. It is honest about its limits too: these are development and test keys, and it does not write SSH key files. The one exception to the browser-only rule is bcrypt, which WebCrypto does not have, so the .htpasswd tab uses a vetted open-source library instead of code written here.

The Key and Token Generator is part of RJL.io's collection of free developer tools. For related jobs, try the Password Generator, the Hash Generator, the JWT Decoder, the UUID Generator and the TOTP Code Generator.

Is your site ready for Google and AI search?

The free SEO Analyzer checks any page in seconds - meta tags, structured data, AI crawler access - and tells you exactly how to fix each issue on your platform.