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 Tool
Generated here, kept here
- Tokens come from
crypto.getRandomValues. Key pairs and HMAC secrets come fromcrypto.subtle.generateKey. Exports usecrypto.subtle.exportKeyand fingerprints usecrypto.subtle.digest. These are the browser's WebCrypto functions;Math.randomis 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
Build a Basic Auth header
Base64 is an encoding, not encryption: anyone who sees the header can read the password. Send it only over HTTPS. The user name and password are encoded as UTF-8, as RFC 7617 recommends.
Decode a Basic Auth header
Make a bcrypt hash and an .htpasswd line
Cost 10 = 1,024 rounds.
Hashing...
Add the line to your .htpasswd file, one line per user. The line always uses the $2y$ label Apache reads. Only bcrypt is offered: the old apr1 (MD5) and {SHA} formats are fast to guess against and are not safe for passwords. The password is hashed in this page, is never sent or stored, and is gone when you reload.
Check a password against a bcrypt hash
Checking...
Works with $2a$, $2b$ and $2y$ hashes up to cost 16. Apache's apr1 and {SHA} entries are recognized but not checked. Nothing you paste or type here leaves the page.
Make an Argon2id password hash
Argon2id is the current first choice for storing passwords: it is slow on purpose and needs a block of memory, which makes guessing on graphics cards expensive. A fresh random 16-byte salt is made for every hash and is part of the string, so you store one value. The work runs in this page with a WebAssembly build of Argon2 (hash-wasm); the password is never sent or stored and is gone when you reload.
Check a password against an Argon2 hash
The memory, iterations and lanes are read from the hash itself, so any standard Argon2 hash works. A hash that asks for more than 256 MiB is refused so a pasted string cannot freeze the page. Nothing you paste or type here leaves the page.
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
| Type | Used for | Size | Notes |
|---|---|---|---|
| ECDSA P-256 | JWT ES256, TLS and code signing | 256-bit curve | Small, fast, widely supported. A good default for signatures. |
| Ed25519 | EdDSA signatures, modern protocols | Fixed | Fast and simple, but not every library or older system reads it. |
| X25519 | Key agreement (Diffie-Hellman), TLS 1.3, WireGuard | Fixed | Makes a shared secret, not signatures. Keys are 32 random bytes, so raw hex and Base64 are shown too. |
| secp256k1 | Bitcoin, Ethereum, ES256K signatures | 256-bit curve | The curve behind most cryptocurrency wallets. Not a NIST curve, so WebCrypto does not offer it; the noble library makes it. |
| RSA 2048 or 3072 | JWT RS256 and PS256, legacy systems | 2048 minimum | Universal support, slower to generate and larger. Choose 3072 or more for long-lived keys. |
| RSA-OAEP | Encrypting a small secret to a public key | 2048 minimum | For wrapping keys, not for signing and not for bulk data. |
| ECDH | Agreeing a shared secret between two parties | 256-bit curve | Never signs anything; the shared secret is then used with a cipher. |
| HMAC secret | JWT HS256, HS384 and HS512, webhook signatures | At least the hash size | One 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
The randomness is sound: keys come from the browser's WebCrypto generator, the same one that protects TLS in that browser. What you cannot know is the state of the device: a browser extension, malware, a screen share or a clipboard manager could see a key you display. We recommend these keys for development and testing, and for production only if you trust the machine and handle the key as carefully as one made with a command-line tool.
Only the browser's WebCrypto API. Tokens use crypto.getRandomValues, with unbiased selection so every character is equally likely. Key pairs and HMAC secrets use crypto.subtle.generateKey. Math.random is never used, and there is no hand-written random number generator or cipher in the page.
Choose ECDSA P-256 for most new signing needs: it is small, fast and widely supported. Choose RSA, at 2048 bits or more, when the other side only supports RSA, as many older systems do. Choose Ed25519 when you know every consumer reads it. For encryption to a public key use RSA-OAEP, and for agreeing a shared secret use ECDH.
PKCS#8 and SPKI are the standard binary layouts for a private key and a public key. PEM is those bytes written as Base64 between BEGIN and END lines so they can be pasted into a file or a setting. A private key here starts with BEGIN PRIVATE KEY and a public key with BEGIN PUBLIC KEY.
It is a short, fixed-length summary of the public key: the SHA-256 hash of its SPKI bytes. Two public keys with the same fingerprint are the same key, so you can compare a few hex pairs instead of a whole PEM block. It does not match an SSH fingerprint, because that hashes a different encoding.
Use at least 128 bits of randomness, and 256 bits for long-lived secrets. The page shows the bits for your choice: 32 hex characters is 128 bits, 43 Base64url characters is 258 bits, and 32 alphanumeric characters is about 190 bits. A prefix such as sk_live_ helps people and scanners recognize a key but adds no strength.
Hex is the simplest and safe everywhere, at 4 bits per character. Base64url packs 6 bits per character and uses only characters that are safe in a URL. Alphanumeric uses letters and digits only, which survives copy and paste and double-click selection, at about 5.95 bits per character. All three are equally strong at equal bit counts.
Only over HTTPS. The header is the user name and password in Base64, which is an encoding anyone can reverse, so on plain HTTP the password is exposed to anyone on the network path. Over HTTPS it is acceptable for simple staging sites and machine-to-machine calls, though a token or a session is usually a better fit for a product.
Partly. The Argon2id tab makes an Argon2id password hash and checks one. The .htpasswd and bcrypt tab makes a bcrypt hash at a cost from 4 to 14, checks a password against an existing bcrypt hash, and builds a user:hash line for an .htpasswd file. It does not write OpenSSH key files or certificates. bcrypt is not part of the browser's WebCrypto, so that tab loads a small open-source JavaScript library the first time you open it. The password stays in your browser.
Each step up in cost doubles the work, so cost 12 takes four times as long as cost 10. Cost 10 is a common default and 12 is a good choice for new systems. The tab shows an estimate measured on your device and warns above cost 12. High costs run in short slices so the page stays responsive, but cost 13 and 14 can still take many seconds, and a server pays that time on every login.
Apache's old apr1 (MD5) and {SHA} (SHA-1) formats are fast to guess against, so a leaked file is cheap to crack, and they are not safe for passwords. Apache 2.4 reads bcrypt, so the tool offers only bcrypt, with the $2y$ label Apache expects. If you paste an apr1 or {SHA} value to check, the tool recognizes it and explains instead of checking it.
No. Every key and token is made and shown in your browser, kept only in the page's memory, and gone when you reload or close the tab. Nothing is saved to cookies or local storage, and no server ever receives a key, a password or a header you type.
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.