Choosing Between RS256 and ES256
Both algorithms are asymmetric, both are widely supported, and both are safe when implemented correctly — so the decision comes down to size, cost and operational fit rather than to security. This page is part of the validating JWTs and rotating signing keys guide.
The Practical Differences
The security question is settled: RSA with SHA-256 and ECDSA on the P-256 curve both provide comparable strength at their standard parameters. What differs is everything around them.
Token size matters more than it sounds. An RSA signature adds roughly 340 base64 characters to every token, and if that token travels in a cookie you are also spending it on every asset request. On a page issuing fifty requests, the difference between the two algorithms is measured in tens of kilobytes of upstream traffic per page view.
Verification speed favours RSA, sometimes substantially — verification is the cheap half of RSA and the expensive half of ECDSA. In absolute terms both are fast enough that the difference disappears next to any database query, but at very high request rates on constrained hardware it is worth measuring rather than assuming.
Choosing for a New System
Default to ES256 unless something forces otherwise. Smaller tokens are a permanent, compounding benefit; the verification difference is negligible at ordinary scale; and every current library and identity provider supports it.
Choose RS256 when a consumer you do not control requires it, when you are integrating with an older enterprise stack whose libraries predate widespread curve support, or when your hardware security module offers better RSA support than elliptic-curve support — which is still true of some deployed devices.
Avoid the temptation to support both indefinitely. A verifier allowlisting two algorithms is fine during a migration and is a permanently wider surface afterwards; each additional accepted algorithm is another implementation whose edge cases you inherit.
Migrating Between Them
The migration is a key rotation with an extra step, and the order is what keeps it safe.
Verify each step before starting the next. After step one, confirm through metrics that every verifier is running the wider allowlist — not that the deploy succeeded, but that the instances report it. After step three, watch the distribution of algorithms in your verification logs until the old one stops appearing, and only then remove it.
Key Management Details That Differ
An RSA key pair is large and slow to generate, which matters if you mint keys frequently — some designs rotate weekly, and generating a 2048-bit key on a constrained device is noticeably slower than generating a P-256 pair. Elliptic-curve keys are small enough that storing several generations is trivial.
Both belong in a key-management service rather than in application configuration, so that signing is an operation the service performs and the private key never appears in a process you deploy. Check your provider’s support before committing: elliptic-curve signing is well supported in modern managed services and less so in older on-premises hardware modules, which is one of the few remaining reasons to choose RSA deliberately.
Whichever you choose, keep the key identifier scheme meaningful — a date plus a sequence, such as 2026-07-a — so a log line naming a key tells you when it was minted without a lookup. That small convention pays for itself during the first incident.
Where the Choice Shows Up in Production
Three places make the difference visible, and none of them is the cryptography.
The first is bandwidth. A token that travels in a header on every API call, or in a cookie on every asset request, carries its signature with it. At a few hundred requests per user session the RSA signature costs a few hundred kilobytes of upstream traffic per user per session — invisible on a fast connection, noticeable on a metered mobile one, and measurable in egress cost at scale.
The second is storage. Systems that persist tokens — an audit trail that records the credential presented, a queue that carries one with each job, a cache keyed by token — store the signature too. The size difference compounds wherever a token is written rather than merely passed.
The third is header limits. Proxies and servers cap total header size, commonly at 8 or 16 kilobytes, and an RSA-signed token with a generous claim set can consume a surprising share of that budget before your application’s own headers are counted. Requests that fail with an oversized-header error rather than an authentication error are a confusing way to discover the limit.
None of these makes RSA the wrong choice — plenty of large systems run on it happily. They are simply the dimensions along which the decision is felt, and they are worth measuring for your own traffic shape rather than inheriting someone else’s conclusion.
Verifying Support Before You Commit
Before choosing, enumerate every component that will verify a token and confirm each supports the algorithm you intend. That list is longer than it first appears: application services, the gateway, background workers, webhook receivers, internal admin tools, any third-party integration that validates your tokens, and any client library embedded in a mobile application whose release cycle you do not control.
Mobile clients deserve particular care, because their release cycle is measured in weeks and their installed base lingers for months. If an old application version cannot verify the new algorithm, switching signing breaks users who have not updated — so either keep the old algorithm available for a version-scoped audience, or gate the change behind a minimum supported application version that you are able to enforce in practice rather than merely request.
Write the list down with a column for the library, its version and the algorithms it supports, and keep it next to the rotation runbook — the two need the same inventory, and maintaining one list rather than two is the difference between it being accurate and it being aspirational.
For each, check the library version rather than the language: support is a property of the library, and a service pinned to an old version for unrelated reasons is exactly where a migration stalls. Where a component cannot be upgraded quickly, decide early whether to delay the migration or to keep that consumer on a separate audience with its own signing configuration — both are reasonable, and discovering the constraint after switching is not.
Frequently Asked Questions
Is ES256 more secure than RS256?
Not meaningfully at standard parameters — both are considered strong. The practical security difference comes from implementation quality rather than from the algorithms: ECDSA is sensitive to nonce reuse, which a well-tested library handles correctly, and RSA is sensitive to padding-scheme choices, which a well-tested library also handles. Choose on size and operational fit, and use a maintained library either way.
Will switching break older clients?
It can, if any consumer uses a library old enough to lack curve support. Inventory the verifiers before starting — including the ones nobody thinks of, such as webhook receivers and internal tools — and confirm each supports the new algorithm. That inventory is the same one your key rotation needs, so building it is not wasted effort.
Does the algorithm affect how long verification takes?
Yes, and in the direction people usually do not expect: RSA verification is faster than elliptic-curve verification, while RSA signing is much slower. Since a token is verified many times and signed once, RSA’s profile is arguably better for very high read volumes. At ordinary scale both are negligible next to the rest of a request, so token size is usually the more consequential difference.
Can I run both algorithms permanently?
You can, and you should not. Every accepted algorithm is another code path whose edge cases you inherit, and a permanently wide allowlist erodes the discipline that makes the allowlist a control at all. Support two only during a migration, with a date on which the old one is removed.
What about EdDSA?
It is an excellent choice technically — small signatures, fast operations, fewer implementation pitfalls than ECDSA — and its constraint is support rather than merit. If every verifier and your provider support it, it is a reasonable default for new systems. Check the whole chain before committing, because it is still the least universally available of the three.
Token Size in Practice
Related
- Validating JWTs and rotating signing keys — the allowlist this decision configures.
- Caching JWKS without breaking key rotation — the cache that must carry both keys during a migration.
- Configuring identity providers for OIDC — checking which algorithms a provider actually offers.