What is an SSH key pair?
An SSH key pair is two mathematically linked files that let you log in to a server without a password. The public key goes on the server, in the ~/.ssh/authorized_keys file; the private key stays on your computer and is never shared. When you connect, the server challenges your computer, your computer proves it holds the private key, and you are in — no password typed, nothing to intercept.
This generator creates a real key pair in your browser, using the WebCrypto API built into Chrome, Edge, Firefox, and Safari. The private key appears as a PEM file and the public key as a one-line OpenSSH key, both ready to save. Nothing is sent to a server, because there is no server involved — the maths runs on your device, and the private key never leaves it.
That last point is the whole reason to generate keys this way. A key generated on a website that runs the maths on its server has, by definition, been seen by that server. A key generated in your browser has been seen by nobody but you. Treat the private key like a password: anyone who has it can log in as you.
How SSH key generation works
Key generation creates two large numbers with a special mathematical relationship. For RSA, the pair is built from two large prime numbers multiplied together; the public key holds the product and an exponent, and the private key holds the primes. Factoring the product back into its primes is practically impossible at 2048 or 4096 bits, which is what makes the key safe.
ECDSA and Ed25519 work differently: they use points on an elliptic curve instead of prime factors. A private key is a random number, and the public key is a point on the curve derived from it. Reversing the derivation is equally impractical, but the keys are far shorter — 256 bits instead of 2048 — and generation and signing are faster.
After generation, the private key is exported as PKCS#8 PEM — the -----BEGIN PRIVATE KEY----- format every SSH client understands. The public key is encoded in the OpenSSH one-line format: the key type, the base64-encoded key data, and your comment. That line is exactly what goes into authorized_keys on the server.
RSA, ECDSA, or Ed25519: which key type should you pick?
RSA 2048 is the safe default. It works everywhere — every server, every client, every tutorial — and 2048 bits is still considered secure. RSA 4096 is stronger but slower to generate and use, and its public key line is much longer. Choose 4096 if you want the maximum margin and do not mind the size.
Ed25519 is the modern recommendation. Its keys are short, generation is instant, and signing is fast. It is supported by OpenSSH since version 6.5 (2014) and by all current servers and clients, including GitHub, GitLab, and all major cloud providers. If your server is not ancient, Ed25519 is the best choice for a new key.
ECDSA P-256 sits between the two: shorter than RSA, but slower than Ed25519 and with a more complicated history. It exists here for compatibility with systems that require it. For most people the choice is simple: Ed25519 for new keys, RSA 2048 when you need maximum compatibility, RSA 4096 when you want the strongest RSA.
A worked example: generating an RSA 2048 key
Click Generate SSH Key Pair with the defaults — RSA 2048 and the comment user@sortrun. In a second or two, the private key box fills with a PEM block starting -----BEGIN PRIVATE KEY-----, about 28 lines long, and the public key box fills with a single line starting ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ... followed by your comment. The fingerprint shows as SHA256: followed by 43 base64 characters.
Save the private key as ~/.ssh/id_rsa and the public key as ~/.ssh/id_rsa.pub, or use the download buttons, which save them with those exact names. Copy the public key line into the server's ~/.ssh/authorized_keys file — one line, no line breaks — and set the permissions: chmod 600 on the private key, chmod 644 on the public key, chmod 700 on ~/.ssh.
Test it with ssh -i ~/.ssh/id_rsa user@server. If it asks for a password, the key was not accepted — check that the public key line is exactly one line in authorized_keys and that the permissions are right. If it logs you in without a password, the key works. You can then disable password login on the server, which is the security win the whole exercise is for.
Who uses an SSH key generator
Developers use SSH keys every day: to push code to GitHub and GitLab, to log in to cloud servers, and to deploy applications. A key replaces a password that can be guessed or phished with a cryptographic proof that cannot. Most teams require keys and forbid password login entirely.
System administrators use them to manage fleets of servers. One key pair, with the public key on a hundred servers, gives access to all of them — and revoking access is a matter of removing one line from authorized_keys. Automated tools, backup scripts, and CI pipelines all authenticate with keys, because a script cannot type a password.
Students and hobbyists meet SSH keys when they rent their first virtual server. The cloud provider asks for a public key at setup, and the server is only reachable with the matching private key. Generating the pair in the browser, downloading both files, and pasting the public key into the provider's dashboard is the standard first step.
SSH keys vs passwords: why keys win
A password can be guessed, phished, or leaked in a breach. An SSH private key cannot be guessed — it is 2048 bits of randomness — and it is never sent to the server, so there is nothing to intercept or leak from the server side. The server only ever sees the public key, which is useless without the private half.
Keys are also more convenient once set up. With ssh-agent, you unlock the key once per session and then log in everywhere without typing anything. A password must be typed every time, which is why people choose weak ones. The trade-off is that a stolen private key is as bad as a stolen password — which is why the private key file must be readable only by you, and why a passphrase on the key is worth adding.
A passphrase encrypts the private key itself, so even if someone copies the file, they cannot use it without the passphrase. This generator produces an unencrypted key — add a passphrase with ssh-keygen -p -f ~/.ssh/id_rsa after downloading, if you want one. For the password side of the same workflow, the password generator makes strong passphrases.
Common mistakes with SSH keys
The most common mistake is sharing the private key. The private key is secret; the public key is public. Sending someone your private key — by email, chat, or a screenshot — gives them your identity. If you need to give someone access to a server, send them your public key and let them add it to authorized_keys, or generate them their own pair.
Second: wrong permissions. SSH refuses keys that are too open: a private key readable by others is rejected outright, which confuses people who think the error is about the key itself. Run chmod 600 ~/.ssh/id_rsa and chmod 700 ~/.ssh. Third: line breaks in the public key. The authorized_keys entry must be exactly one line — a wrapped or split line is silently ignored, and login falls back to password.
Fourth: generating a key on a server you do not trust and downloading the private key. If the server was compromised, the key is compromised. Generate keys on hardware you control — your own laptop, or this page in your own browser — and never on a shared or public machine. Fifth: losing the only copy of the private key. There is no password reset for a key: if it is gone, generate a new pair and replace the public key everywhere.
How to use this SSH key generator
Pick the key type — RSA 2048 is the default and works everywhere; Ed25519 is the modern choice. Enter a comment, usually your username and machine, so you can recognise the key later. Click Generate SSH Key Pair now. The private key appears in the first box and the public key in the second, with the SHA-256 fingerprint above them.
Download both files with the buttons, or copy the text by hand. Save the private key as ~/.ssh/id_rsa with permissions 600, and add the public key line to the server's ~/.ssh/authorized_keys. Never paste the private key into a website, a chat, or a ticket — it is yours alone. Keep a backup of the private key somewhere safe, such as an encrypted USB drive or a password manager that stores files, so a lost laptop does not lock you out of every server.
Everything runs in your browser with no sign-up and nothing uploaded, so the private key is never transmitted anywhere. For related tools, the password generator makes strong passphrases for your key, the hash generator can fingerprint files you download, and the JWT generator makes signed tokens for APIs.