Skip to main content
securityssh

SSH Key Types Compared: RSA vs Ed25519 vs ECDSA

Which SSH key algorithm should you generate in 2026? Performance, security, and compatibility compared.

Astound1 min read

If you're still generating RSA 2048-bit SSH keys, it's time to upgrade. Ed25519 and ECDSA offer the same or better security with dramatically smaller keys and faster operations.

Side-by-side comparison

AlgorithmKey sizeSecurity levelKey genSigning speedCompatibility
RSA 20482048 bit~112 bitsSlowFastUniversal
RSA 40964096 bit~152 bitsVery slowSlowerUniversal
ECDSA P-256256 bit~128 bitsFastVery fastOpenSSH 5.7+
ECDSA P-384384 bit~192 bitsFastFastOpenSSH 5.7+
Ed25519256 bit~128 bitsInstantInstantOpenSSH 6.5+

A 256-bit Ed25519 key provides the same security level as a 3072-bit RSA key — in 68 bytes instead of 2,500+.

Ed25519 (EdDSA over Curve25519) is the best choice for almost everyone in 2026:

  • Tiny keys — 68 bytes (public) and 80 bytes (private). No more 4KB authorized_keys files.
  • Instant key generation — useful when you need per-service or per-session keys.
  • No NIST curves — Ed25519 was designed independently, avoiding the trust concerns around NIST-recommended curves.
  • Supported everywhere — OpenSSH 6.5+ (released 2014), GitHub, GitLab, AWS, all major OSes.
ssh-keygen -t ed25519 -C "[email protected]"

ECDSA: the fallback

If you must use a NIST curve (some enterprise SSH servers only accept ECDSA), P-256 is the sweet spot:

ssh-keygen -t ecdsa -b 256 -C "[email protected]"

Avoid P-521 — it's slower with no practical security benefit over Ed25519.

RSA: only for legacy

RSA remains universally compatible. If you're connecting to old servers or embedded devices running ancient SSH versions, RSA 4096 is your only option:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Never generate RSA keys shorter than 4096 bits. RSA 2048 is below the 128-bit security threshold and deprecated by NIST.

Converting between formats

You may need to convert keys between PEM, OpenSSH, and JWK formats when working across ecosystems:

# PEM to OpenSSH
ssh-keygen -i -f key.pem > key.pub

# OpenSSH to PEM
ssh-keygen -e -m pem -f key.pub > key_pem.pub

The Key Toolkit generates RSA, EC (P-256/P-384/P-521), and Ed25519 key pairs, inspects existing keys, extracts public keys, computes fingerprints, and converts between PEM, DER, JWK, and OpenSSH formats — all in your browser.

AstoundPart of the Astound Dev Tools writing on developer tools.