What is an SSH key pair?
An SSH key pair replaces a password when you log in to a server, push to Git or deploy code. It has two halves. The private key stays with you. The public key goes on the server, as one line in ~/.ssh/authorized_keys. When you connect, the server sends a challenge and your client proves it holds the private key, without ever sending it. Anyone can read the public half and it does not help them log in.
This page makes that pair in your browser. You choose the key type: Ed25519 (recommended), ECDSA with P-256, P-384 or P-521, or RSA with 2048, 3072 or 4096 bits. Ed25519 is short, fast and the default choice today. RSA is the one to pick only when an old system cannot read anything else. For RSA, 3072 bits is a sensible size, and 4096 takes longer to generate (up to about a minute) for little practical gain.
The page shows the public key as an OpenSSH line or as PEM SubjectPublicKeyInfo, and the private key as an OpenSSH file (the ssh-keygen default), PEM PKCS#8, or the old PEM PKCS#1 (RSA) and SEC1 (ECDSA) styles. It also shows the SHA256 and MD5 fingerprints, which are the short codes ssh prints when you connect to a host for the first time and that you can compare with what a server or a colleague reports.
Everything is computed locally with the secure random generator of your system. Nothing is uploaded. Even so, for a key that guards something important, generate it on the machine that will use it.
How to generate an SSH key
- Open the page. A new pair is already made with Ed25519. Pick another Key type: if you need it. For RSA, also choose RSA size (bits):.
- Edit Comment (end of the public key):. It is only a label, usually
user@machine, and it ends up at the end of the public line. - Type a Passphrase (optional): to encrypt the private key. If you leave it empty, the file is not encrypted and anyone who gets it can use the key.
- Choose Private key format: and Public key format:. For
sshand Git, keep the OpenSSH choices. - Press Generate new key pair for a different pair. Changing a format, the comment or the passphrase only rewrites the same key.
- Copy the keys with Copy public key and Copy private key, or use the download buttons.
- On Linux or macOS, save the private key as
~/.ssh/id_ed25519, runchmod 600on it, and add the public line to the server's~/.ssh/authorized_keys.
Examples
A key for a server login
Keep Ed25519 and the OpenSSH formats. The public key is one line that starts with ssh-ed25519, then the Base64 key, then your comment. Paste that line into authorized_keys on the server. The private file starts with -----BEGIN OPENSSH PRIVATE KEY-----.
A key for a service that wants PEM
Some tools, such as certain CI systems and older libraries, do not read the OpenSSH private format. Choose PEM PKCS#8 for the private key. For RSA or ECDSA you can also pick the PKCS#1 or SEC1 style, which starts with BEGIN RSA PRIVATE KEY or BEGIN EC PRIVATE KEY. That option is disabled for Ed25519, which has no such format.
A key protected by a passphrase
Type a passphrase and the page tells you the file is encrypted. OpenSSH files use aes256-ctr with bcrypt_pbkdf, PEM files use AES-256. If you forget the passphrase there is no recovery, so keep it in a password manager. To check how strong a passphrase is, use the password strength analyser.
Checking a fingerprint
The SHA256 fingerprint is what ssh-keygen -lf id_ed25519.pub prints. Compare it with the value shown by your Git host or your colleague before you trust a key.
Common mistakes
- "This key has no private part." You tried to write a private format from a key that only has the public half. Press Generate new key pair.
- "Could not derive the key from the passphrase." The passphrase could not be turned into an encryption key. Try again, and avoid unusual control characters.
- "Something went wrong: ..." An unexpected failure, with the detail. Reload the page and generate again.
- Permissions too open. If
sshsays the private key is "too open", runchmod 600 ~/.ssh/id_ed25519. - Pasting the private key on the server. Only the public line goes into
authorized_keys. - Losing the key. Nothing is stored here. When you close the page, the pair is gone unless you saved it.
Frequently asked questions
Is it safe to generate a key in a web page?
The keys are made in your browser and never sent anywhere, but you are trusting the page code and the browser. For a key that guards production systems or money, generate it on the machine that will use it with ssh-keygen.
Ed25519 or RSA?
Choose Ed25519 unless a system you must reach cannot read it. It has small keys and fast signatures, and it is supported by OpenSSH 6.5 and later. RSA of 3072 bits or more is the fallback.
What is the comment for?
It is a free label at the end of the public line, to help you tell keys apart in authorized_keys. It is not checked and it does not change the key.
Can I get the public key from a private key I already have?
Yes. Use the public key extractor. To sign or encrypt data with the pair, see sign and encrypt with a public key.
Equivalent commands
# Ed25519, same as this page
ssh-keygen -t ed25519 -C "me@example" -f ~/.ssh/id_ed25519
# RSA 3072 in PEM
ssh-keygen -t rsa -b 3072 -m PEM -f ~/.ssh/id_rsa
# Fingerprint of a public key
ssh-keygen -lf ~/.ssh/id_ed25519.pub