Overview

For new SSH keys, use Ed25519. It is secure, fast, and its keys are short. Use RSA (3072 bits or more) only when you must connect to a system too old to support Ed25519.

Use
Ed25519
Fallback
RSA, 3072 bits or more
Avoid
DSA and short RSA keys

How they compare

Ed25519 RSA
Security Strong, with a design that avoids common implementation mistakes Strong at 3072 bits or more; weak below 2048
Speed Fast to generate, sign and verify Slower, especially at large key sizes
Key size Short (256-bit, one line) Long
Support OpenSSH 6.5 (2014) and later, including Windows OpenSSH Everywhere, including very old systems

Create a key

ssh-keygen -t ed25519            # recommended
ssh-keygen -t rsa -b 4096         # only for systems without Ed25519

Linux to Windows

Windows Server 2019 and later ship OpenSSH with Ed25519 support, so the same Ed25519 key works for Linux and Windows destinations. See password-less SSH connections.

Avoid

  • DSA keys: disabled in current OpenSSH.
  • RSA keys under 2048 bits: too weak.
  • Sharing one private key between many people: give each person or automation its own key, so you can revoke one without the others.