Ed25519 vs RSA — which SSH key to choose in 2026

You're creating an SSH key, and the guide offers two options: -t rsa -b 4096 or -t ed25519. Which one?
Here's a visible difference. I generated both. The Ed25519 public key is 82 characters, one short line. The 4096-bit RSA public key is 726 characters. Almost nine times longer.
And yet the short key is no weaker than the long one. Let's see why, and what to pick.
What these are
Both are ways to make a key pair for logging in over SSH: the private key stays with you, the public one goes on the server. The math inside differs.
- RSA is a 1977 algorithm. Its strength rests on how hard it is to factor a huge number. To stay strong, keys keep getting longer: 2048, 3072, 4096 bits.
- Ed25519 is a 2011 algorithm based on elliptic curves. It uses a different hard problem, so a short key gives the same protection as a long RSA one. Ed25519 is roughly comparable to 3072-bit RSA.
If you want to understand how keys protect data in general, see what encryption is.
Point-by-point comparison
Security.
- Ed25519: strong out of the box, with almost no parameters to get wrong.
- RSA: strong at 3072 bits and up. A 1024-bit key has long been considered unsafe.
Key size.
- Ed25519: an 82-character public key, easy to paste and read.
- RSA 4096: 726 characters, easy to truncate when copying.
Speed.
- Ed25519: fast signing, the key is created instantly.
- RSA 4096: noticeably slower to create, slower to sign.
Compatibility.
- Ed25519: supported by all modern software — OpenSSH since 2014, GitHub, GitLab, cloud servers.
- RSA: works almost everywhere, including very old devices.
The default.
- Since OpenSSH 9.5 (2023),
ssh-keygenwith no flags makes Ed25519. - Older versions defaulted to 3072-bit RSA. I checked on Ubuntu 22.04 with OpenSSH 8.9: a bare
ssh-keygenproducedssh-rsa.
The catch: "my old RSA key stopped working"
Here's what confuses people. Your RSA key worked for years. You update your system — and login breaks with an error like:
no matching host key type found. Their offer: ssh-rsa
It looks like RSA was "banned." It wasn't. What was turned off is not the key but the old signature method — ssh-rsa, which uses the outdated SHA-1 hash.
Since OpenSSH 8.8 that method is off by default. The very same RSA key keeps working through the newer rsa-sha2-256 and rsa-sha2-512 signatures. It only breaks when the other side is very old and knows no other signatures — an old router, an ancient server.
What to do:
-
If you can update the server — do. That's the best path.
-
If you can't, enable the old signature for that server only in ~/.ssh/config:
Host old-router HostKeyAlgorithms +ssh-rsa PubkeyAcceptedAlgorithms +ssh-rsaDon't put this under
Host *— you'd weaken every connection.
Which one fits whom
Choose Ed25519 if you're creating a key for GitHub, your VPS, a cloud server or your work laptop. That is, almost always. The command:
ssh-keygen -t ed25519 -C "laptop-2026"
-C is the key's label, so you can tell later where it came from. And set a passphrase when creating the key — don't skip it.
Choose RSA only if a system explicitly won't accept Ed25519. That happens with old network hardware and some corporate systems. Then go no lower than 3072 bits:
ssh-keygen -t rsa -b 4096
Have an old RSA key and everything works? No need to replace it urgently. But at the next rotation — switch to Ed25519.
Moving over takes three steps:
- Create the new key with the command above.
- Add it to the server without removing the old one:
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server. - Make sure login with the new key works, and only then delete the old key's line from
~/.ssh/authorized_keyson the server.
Order matters: remove the old key first, and you can lock yourself out.
FAQ
Can I have both keys at once?
Yes. The keys live in separate files (id_ed25519 and id_rsa), and SSH tries them in turn. You can set the right key for a specific server in ~/.ssh/config.
Does Ed25519 protect against quantum computers?
No, and neither does RSA. Both are vulnerable to future quantum machines, which is why OpenSSH developers are already adding post-quantum algorithms for key exchange. For a personal SSH key today, there's no difference between the two here.
How do I see which key I have?
Run ssh-keygen -l -f ~/.ssh/id_rsa.pub (or the path to your key). The end of the line shows the type — (ED25519) or (RSA) — and the length in bits.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





