RSA & SSH Key Generator

RSA key pairs, and Ed25519 where the browser supports it, as PEM and OpenSSH files.

About RSA & SSH Key Generator

An RSA and SSH key generator that creates RSA 2048, 3072, 4096 and Ed25519 key pairs in your browser, as PEM and OpenSSH files.

How to use

  1. Choose a key type. Ed25519 is offered only when your browser can generate it.
  2. Add a comment if you want one, such as an email address. It ends the public key line and is stored in the OpenSSH private key; you can change it after generating without making a new key.
  3. Press Generate. RSA 4096 can take several seconds.
  4. Copy or download each output. The OpenSSH pair is named id_ed25519 and id_ed25519.pub, or id_rsa and id_rsa.pub.
  5. After saving a private key, run chmod 600 on it, and ssh-keygen -p -f on the OpenSSH file to add a passphrase.

What it does

Keys are generated by the browser's WebCrypto API; RSA keys use the public exponent 65537. Each pair is shown in these forms:

Output Format First line
Public key · OpenSSH one line for authorized_keys ssh-rsa … or ssh-ed25519 …
Fingerprint the line ssh-keygen -lf prints 256 SHA256:… comment (ED25519)
Public key · SPKI PEM X.509 SubjectPublicKeyInfo -----BEGIN PUBLIC KEY-----
Private key · OpenSSH OpenSSH's own format, unencrypted -----BEGIN OPENSSH PRIVATE KEY-----
Private key · PKCS#8 PEM PKCS#8, unencrypted -----BEGIN PRIVATE KEY-----
  • The two private outputs are the same key in two formats. Use the OpenSSH file with ssh, and PKCS#8 with OpenSSL, JWT libraries and most language runtimes.
  • The fingerprint is the SHA-256 hash of the public key blob in unpadded Base64, the value SSH shows when it asks you to confirm a key.
  • Some OpenSSH builds, including the one shipped with macOS, cannot read an Ed25519 key in PKCS#8, which is why the OpenSSH format is provided.

What it does not do:

  • It does not protect the private key with a passphrase. Both private outputs are unencrypted until you add one yourself.
  • It does not produce PKCS#1 (BEGIN RSA PRIVATE KEY), PuTTY .ppk, ECDSA or DSA keys, certificates or signing requests.
  • It does not keep keys. Generating again or leaving the page discards the pair for good.

Example

Public key · OpenSSH
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINM0KNDPC6fsjW7LU+e/Zaj7Nc7kkMF68xAvMUiVZbYt deploy key

Fingerprint
256 SHA256:lKeP2n84XeiD9qKCwLXXrbRuJUTFS29YzPy1dMgRcOA deploy key (ED25519)

Public key · SPKI PEM
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA0zQo0M8Lp+yNbstT579lqPs1zuSQwXrzEC8xSJVlti0=
-----END PUBLIC KEY-----

Privacy

Keys are generated and encoded by your browser on this page. Neither the private nor the public key is uploaded, no request is made, and nothing is stored.

Frequently asked questions

Is it safe to generate SSH keys in a browser?
The keys come from the browser WebCrypto API, which uses the operating system random source, and this page never sends them anywhere. The weak points are the browser itself and the clipboard, so for a long-lived production key running ssh-keygen on the machine that will hold it is the better habit. For test systems, CI and lab machines a browser-made key is fine.
Should I use RSA or Ed25519 for SSH?
Use Ed25519 unless something you connect to does not support it. Its keys are short, fast and have no size parameter to get wrong. Choose RSA with 3072 bits or more for older servers, appliances and services that only accept RSA.
What is the difference between an OpenSSH private key and a PKCS#8 key?
They are two containers for the same key. The OpenSSH format (BEGIN OPENSSH PRIVATE KEY) is what ssh-keygen writes and every OpenSSH tool reads. PKCS#8 (BEGIN PRIVATE KEY) is the standard container that OpenSSL, Java, Go, Node and most libraries expect.
How do I add a passphrase to an SSH private key?
Save the OpenSSH private key to a file, restrict it with chmod 600, then run ssh-keygen -p -f followed by the file name and enter a new passphrase when asked. The key stays the same; only the file is re-encrypted.