SSH key sizes by key type

Public key and private key lengths for each SSH key type that ssh-keygen can generate, with the source each figure comes from, for operators auditing key files.

On this page

SSH key sizes by key type at a glance

The two figures most often checked are the Ed25519 public key, which is 32 octets, and its signature, which is 64 octets, as defined in RFC 8032 and carried into SSH by RFC 8709. The default RSA key that ssh-keygen generates is 3072 bits, and the OpenBSD ssh-keygen(1) manual page gives 1024 bits as the minimum RSA size it will accept. Ed25519 is also the default key type for ssh-keygen (-t ed25519), so a key file created with default settings will usually show these lengths. Confirm the values against the manual page for the OpenBSD release you run, because defaults can change between versions.

This table is for operators auditing key files under ~/.ssh and for reviewers checking the key types in use against an internal cryptography or access policy. An auditor can use the key type and length to sort files into groups: Ed25519 keys have a fixed length and ignore -b, ECDSA keys accept only 256, 384 or 521 bits with -b, and RSA keys take any length from the stated minimum up. The ECDSA and Ed448 signature and key lengths are in RFC 5656 and RFC 8709, and the RSA and DSA public key formats are in RFC 4253, which does not set a minimum RSA key size.

The table does not say whether any key type, length or product meets a particular policy, standard or certification, and no product in this table should be described as compliant on the basis of its key type alone. Reviewers should confirm each finding against their own policy text and against the documentation for the SSH server and client versions in their environment. The post-quantum key type mldsa44-ed25519 appears in the ssh-keygen -t list on the OpenBSD manual page, and its key and signature lengths should be taken from the specification or the vendor documentation rather than from this table.

Key sizes for each ssh-keygen key type

This table lists each key type that ssh-keygen accepts, with the public key, private key and signature sizes the sources give for it. Blank cells mean the sources do not state that figure, so check the key file or the specification before relying on it. Note that ssh-keygen ignores -b for ecdsa-sk, ed25519 and ed25519-sk because their length is fixed.

Key typePublic key or blob sizePrivate key sizeSignature size
ssh-ed25519 (ed25519)32 octets (public key)32 octets (RFC 8032 private key)64 octets
ssh-ed44857 octets (public key)57 octets (RFC 8032 private key)114 octets
ssh-rsa (rsa)String "ssh-rsa" plus mpint e and mpint n; no minimum size in RFC 4253Default 3072 bits, minimum 1024 bits (ssh-keygen -b)RSASSA-PKCS1-v1_5 with SHA-1; size not stated
ssh-dssString "ssh-dss" plus mpints p, q, g and yNot statedr and s as 160-bit integers each
ecdsa-sha2-nistp256Type string, curve identifier and point Q (SEC1 octet string; compression may be used)Not stated; -b accepts 256 for ecdsaSHA-256 for curves up to 256 bits
ecdsa-sha2-nistp384Type string, curve identifier and point Q (SEC1 octet string; compression may be used)Not stated; -b accepts 384 for ecdsaSHA-384 for curves above 256 and up to 384 bits
ecdsa-sha2-nistp521Type string, curve identifier and point Q (SEC1 octet string; compression may be used)Not stated; -b accepts 521 for ecdsaSHA-512 for curves larger than 384 bits
ecdsa-sk and ed25519-skFixed length; -b is ignoredNot statedNot stated

How to read the key size columns

The size columns on this page describe the key material itself, not the public key blob that appears in an SSH key file or on the wire. An SSH public key blob is the SSH wire encoding of the key: first a string naming the key type (for example, ssh-rsa, ssh-ed25519 or ecdsa-sha2-nistp256), then the fields that the key type defines. For RSA, the blob carries the public exponent e and modulus n as mpint values. For ECDSA, it carries the key type string, the curve identifier string and the point Q as an octet string. The blob is therefore longer than the bare key, and the length prefixes, type names and curve names add to it. Per RFC 4253, Section 6.6, the ssh-rsa blob is the string "ssh-rsa" followed by mpint e and mpint n. Per RFC 5656, Section 3.1, the ECDSA blob holds the key type, the curve identifier and Q. Check the length of the whole blob when you need the size on the wire, and the length of the key material when you need the size of the key.

Units matter when you compare figures. Sizes in this section are given in octets (bytes) for encoded and fixed-length keys, and in bits for RSA and ECDSA parameters. RSA key lengths are stated in bits, so a 3072-bit key does not correspond to a 3072-octet blob. In ssh-keygen, the -b option sets the length in bits. For RSA, the OpenBSD ssh-keygen(1) manual page gives a minimum of 1024 bits and a default of 3072 bits. For ECDSA, -b accepts only 256, 384 or 521, and other values fail. For ECDSA-SK, Ed25519 and Ed25519-SK keys, the length is fixed and ssh-keygen ignores -b. Ed25519 keys use a 32-octet public key and a 64-octet signature, as RFC 8709, Sections 4 and 6, states.

RSA deserves a specific check because RFC 4253 sets no minimum key size for ssh-rsa. The RFC leaves the minimum to implementations, so a server or client can accept a shorter key than ssh-keygen will generate. Before you rely on a key length, confirm the minimum your SSH server and client enforce, and review any RSA keys below the ssh-keygen default of 3072 bits. The -t values that ssh-keygen accepts (ecdsa, ecdsa-sk, ed25519, ed25519-sk, mldsa44-ed25519 and rsa) are listed on the OpenBSD manual page, and the version of OpenSSH you run determines which of them your tools support. Confirm that version and its documentation before you treat any listed value as available.

Where SSH key sizes affect audits and configuration

SSH key sizes matter at four points: auditing key files already on disk, checking RSA strength against the default or a policy minimum, validating -b values for ECDSA, and confirming which key types a server accepts. Each card names one of these checks and what to confirm before acting on the result.

Auditing key files on disk

Inventory tools need to read the key type and length of each file in a user's ~/.ssh directory or a host key directory. The key type and length appear in the public key line and in the output of ssh-keygen -l -f on the public key file. Record the type and bit length for each key, then flag any RSA key under your policy minimum and any key type your policy does not allow. Ed25519 keys have a fixed length, so a length field alone does not show their strength.

ssh-keygen manual

Checking RSA against the default

The OpenBSD ssh-keygen manual lists 3072 bits as the default RSA size and 1024 bits as the minimum it accepts. A key at 1024 bits is accepted by the tool but sits at the floor, so a stricter internal policy may reject it. Compare each RSA key's bit length with both the 3072-bit default and your own minimum, and treat any key at the floor as a candidate for regeneration.

ssh-keygen manual

Validating ECDSA -b values

For ECDSA keys, ssh-keygen -b accepts only 256, 384 or 521, and any other value fails. Scripts that generate keys with a fixed bit count should use one of these three values, and the three map to the nistp256, nistp384 and nistp521 curves. Check generation scripts and configuration management templates for values outside this set, because the failure appears at generation time rather than in any later audit.

ssh-keygen manual

Ignoring -b for fixed-length keys

ECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length, and ssh-keygen ignores the -b flag for them. Audit tooling that flags a missing or unexpected bit count on these key types will produce false findings. Build the check so that it reads the key type first and applies a length rule only to RSA and ECDSA, where the length is a configurable choice.

ssh-keygen manual

Confirming server-accepted key types

A key that an audit approves still needs to be accepted by the server it authenticates to. Check the server's supported host key and public key algorithms in its configuration and documentation, and confirm the key type your audit allows appears in that list. Server-side settings, not the key file, decide whether a key is accepted, so check both sides before retiring a key type.

RFC 4253 text

Figures for each key type, one tab per option

The ecdsa option creates an ECDSA key, and the -b flag selects the curve size. The OpenBSD manual page for ssh-keygen(1), read on 4 December 2026, says that for ECDSA keys -b accepts only 256, 384 or 521, and that other values fail. RFC 5656 defines the ECDSA key types, with the required curves nistp256, nistp384 and nistp521 (Sections 6.1, 6.2 and 10.1).

  • Accepted lengths: -b takes 256, 384 or 521 only, per the OpenBSD manual page.
  • Key type names: The SSH key type string is ecdsa-sha2- followed by the curve identifier (RFC 5656, Section 6.1).
  • Public key blob: The blob holds the key type string, the curve identifier string and the point Q, encoded as an octet string per SEC1 Section 2.3.3. RFC 5656 says point compression MAY be used (Section 3.1).
  • Signature hash: SHA-256 is used for curves up to 256 bits, SHA-384 for curves above 256 and up to 384 bits, and SHA-512 for larger curves (RFC 5656, Section 6.2.1).

Check the -b value on each key file you audit, and confirm the curve identifier in the public key matches the expected curve for that length.

How to use these figures in a key audit

This sequence lets you identify each SSH key's type and length from its own file or output, then compare it against the sizes ssh-keygen defines and the types the server accepts. The result is a per-key record you can check against the figures on this page.

  1. Identify the key type and bit length

    Run ssh-keygen -l -f against each public key file to read its type and length, or check the key file header and any ssh-keygen output you already have. Record the type string (for example ssh-ed25519, ecdsa-sha2-nistp256 or ssh-rsa) and the reported bit count. Work from the key file itself rather than from a filename or inventory label, since file names can be misleading. The step is complete when every key in scope has a recorded type and length.

  2. Compare RSA lengths against the defaults

    For each RSA key, compare the recorded length with the 3072-bit default that ssh-keygen uses and the 1024-bit minimum it accepts. Flag any key below 1024 bits as outside what ssh-keygen will generate. Keys between 1024 and 3072 bits are not wrong by this check alone, but they are below the default and should be listed for review. RFC 4253 states no minimum key size, so the 1024-bit floor comes from ssh-keygen, not from the protocol. The step is complete when each RSA key is marked at, above or below the default.

  3. Check ECDSA curve sizes

    For each ECDSA key, confirm the curve identifier in the key type is nistp256, nistp384 or nistp521, which correspond to the 256, 384 and 521 values ssh-keygen -b accepts. Note that ssh-keygen rejects any other -b value for ECDSA, so an unusual curve in a key file is a point to investigate. Also note that ECDSA-SK, Ed25519 and Ed25519-SK keys have a fixed length, and -b is ignored for them, so a bit-length check does not apply to those types. The step is complete when every ECDSA key has its curve recorded and checked.

  4. Confirm the server's accepted key types

    Review the server's own SSH configuration to see which host key and user key types it offers and accepts. Read the relevant directives in the server's sshd configuration and the host key files it loads, then compare them with the inventory from the earlier steps. Keys that are present but not offered by the server, and key types the server offers but no client uses, both belong in the audit record. The step is complete when the server's accepted key types are written down next to the key inventory.

  5. Ask the vendor or build which key types are supported

    Ask the vendor, or check the OpenBSD build on the host, for the list of key types it supports. The ssh-keygen manual page lists the -t values it accepts, including ecdsa, ecdsa-sk, ed25519, ed25519-sk, mldsa44-ed25519 and rsa, but a particular build or vendor package may differ, so confirm against the version you run. Record the build version and the list returned. The step is complete when the supported list is recorded for each build in scope, and any key type in the inventory that does not appear on it is flagged.

What these SSH key sizes do not tell you

The lengths on this page are key and signature encoding lengths taken from the cited documents, such as the octet counts in RFC 8709 and RFC 8032 and the blob structure in RFC 4253. They are not measured sizes of the files on your disk. A private key file stored in PEM or OpenSSH private key format wraps the raw key material in headers, base64 encoding, padding and, for some formats, additional fields. Those encodings add overhead that the sources listed here do not quantify, so a file on disk will be larger than the figure in the table. If you are auditing key files, measure the files you have, and do not treat the table values as their on-disk size.

A length on this page does not mean the key is acceptable. RFC 4253 states that it sets no minimum key size for ssh-rsa, and the ssh-rsa signature uses RSASSA-PKCS1-v1_5 with SHA-1. Both facts describe what the protocol allows, not what is safe to deploy. The same applies to ssh-dss, whose 160-bit signature integers are listed here only as encoding detail. The ssh-keygen minimum of 1024 bits for RSA is a tool constraint, and it is not a recommendation. Check your organization's policy and the current guidance from the relevant standards body before relying on any key length or key type in this table.

Implementations may differ from the documents, so confirm against the version you have installed. The figures here come from the OpenBSD ssh-keygen(1) manual page as read on 4 December 2026 and from the RFCs named on this page. Your distribution may ship a different OpenSSH release, patch set or default, and the accepted -t values and -b behavior can change between releases. Run ssh-keygen -? or check the man page for the installed binary, and inspect a generated key with ssh-keygen -l -f before you rely on its length or type.

Questions people ask about SSH key sizes

How big is an Ed25519 public key in octets?

An Ed25519 public key is 32 octets. The ssh-ed25519 public key type carries the 32-octet public key defined in RFC 8032, and RFC 8709 uses that same length for the SSH encoding. The corresponding private key is also 32 octets under RFC 8032, Section 5.1.5. Because Ed25519 has a fixed length, ssh-keygen does not let you choose a different size for it. When you audit key files, check that the public key material decodes to 32 octets. The SSH public key line in the .pub file is longer than 32 octets because it is base64 encoded and includes the key type string, so compare decoded lengths rather than text lengths. Confirm the exact encoding against RFC 8709 and your own key files.

How long is an RSA key from ssh-keygen by default?

The default RSA key length from ssh-keygen is 3072 bits. The OpenBSD ssh-keygen(1) manual, read on 4 December 2026, gives a default of 3072 bits and a minimum of 1024 bits. You can request a different length with the -b option when you pass -t rsa. A larger modulus produces a longer public key and a longer signature, so the length you pick affects the size of every key file and every authentication exchange that uses it. Check the length in an existing key with ssh-keygen -l -f against the key file. The manual page is the source for these values, and your OpenSSH version may differ, so confirm the default on the version you run at the OpenBSD manual page.

Which -b values does ssh-keygen allow for ECDSA keys?

For ECDSA keys, ssh-keygen -b accepts only 256, 384 or 521. Other values fail. These values select the NIST P-256, P-384 and P-521 curves, which RFC 5656 names as nistp256, nistp384 and nistp521. The OpenBSD ssh-keygen(1) manual, read on 4 December 2026, documents this restriction. When you audit an ECDSA key, the curve identifier in the key type string tells you which size is in use. If a script or runbook passes a value outside this set, the key generation step will fail, so check the flag before rolling it out. Confirm the accepted values for your OpenSSH version against the manual page.

Does ssh-keygen accept -b for Ed25519 keys?

No. ssh-keygen ignores -b for Ed25519, Ed25519-SK and ECDSA-SK keys because these types have a fixed length. The OpenBSD ssh-keygen(1) manual, read on 4 December 2026, documents this behavior. The default key type is Ed25519, so ssh-keygen with no -t option produces an Ed25519 key that ignores any -b value you pass. If you need a particular size, choose the key type that supports it, such as RSA with -b or ECDSA with one of the three allowed values. Confirm this behavior on the OpenSSH version you run, since a script that passes -b may appear to succeed while the value has no effect.

How big is an ssh-rsa signature compared with an Ed25519 signature?

An Ed25519 signature is 64 octets, as RFC 8709 Sections 4 and 6 give for ssh-ed25519. The ssh-rsa signature is sized by the RSA modulus, so it grows with the key length. RFC 4253 Section 6.6 defines the ssh-rsa public key blob as the string ssh-rsa followed by mpint e and mpint n, and it signs with RSASSA-PKCS1-v1_5 and SHA-1. The signature is therefore the length of the modulus, which for a 3072-bit key is much larger than 64 octets. RFC 4253 also states no minimum key size for ssh-rsa, so the length you choose is a policy decision. The public key blob for RSA is also larger than the 32-octet Ed25519 public key. Check exact byte counts for your key length against RFC 4253 and your own key files.

Can I generate these key types myself with ssh-keygen?

Yes. ssh-keygen is part of OpenSSH, and you can generate Ed25519, RSA and ECDSA keys with it directly, using -t to choose the type and -b where the type accepts a length. The manual page at OpenBSD documents each option. The steps are short, but the decisions that matter are the key type, the length where it applies, and where the private key is stored and who can read it. A team can handle these decisions internally, or ask an outside party to review its configuration. If you want an independent review of how keys are generated, stored and rotated across your environment, DeployOpen can plan and document that work in your own infrastructure under a fixed scope agreed in writing. Confirm the current key generation options against the OpenBSD manual before you change any runbook.

Which RFC defines the SSH public key blob for each key type?

The SSH transport layer defined in RFC 4253 Section 6.6 gives the public key blob format for ssh-rsa and ssh-dss. ECDSA key type names and their curve identifiers are defined in RFC 5656, which covers the required curves nistp256, nistp384 and nistp521. Ed25519 and Ed448 keys in SSH are defined in RFC 8709, which gives the 32-octet and 57-octet public key lengths and the 64-octet and 114-octet signature lengths. The private key lengths come from RFC 8032. When you check a key file, identify the key type string first, then read the matching RFC for the blob format and the lengths. Confirm the exact format against each RFC, since they define the wire encoding and not the file layout.

How DeployOpen works on this

DeployOpen approaches SSH key sizes by key type as a file audit followed by a configuration review. We scope the key types your operators actually use, then check each key file against the sizes and fixed lengths its type defines, and document the results for your records.

How we scope

  • We agree in writing which SSH key types and key files fall inside the engagement before work starts.
  • We confirm which ssh-keygen version and which -t values your operators use, since accepted options vary by release.
  • We agree whether the review covers host keys, user keys, or both, and which systems hold them.
  • Engagements are fixed-scope, and ongoing support is available as a retainer once the audit is complete.

How we build

  • We inventory key files and record each key type, and for RSA and ECDSA keys the configured bit length.
  • We compare RSA lengths against the 1024-bit minimum and 3072-bit default that ssh-keygen documents.
  • We check ECDSA keys for the 256, 384 or 521 bit lengths that ssh-keygen -b accepts, and flag any other value.

How we hand over

  • We deliver a written inventory listing each key file, its type, its length and its location on each host.
  • We document the fixed lengths for Ed25519, Ed25519-SK and ECDSA-SK keys, where ssh-keygen ignores the -b option.
  • We provide remediation notes showing which keys to regenerate and the ssh-keygen commands your team would run.

How we support

  • We can retest the key inventory after your team regenerates or rotates keys, to confirm the changes took effect.
  • We can help your team confirm compatibility with the mldsa44-ed25519 key type for the OpenSSH versions you run.
  • Retainers cover upgrades, continuous testing and updates to the inventory as your key estate changes over time.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.