HS256 — Symmetric

Uses one shared secret. Simple but every service that verifies tokens must know the secret.

ProsCons
Fast, simple setupSecret must be shared with all verifiers
Good for monolithsSecret leak compromises all tokens

RS256 — Asymmetric

Private key signs, public key verifies. Ideal for microservices and OAuth/OIDC.

ProsCons
Public key can be distributed via JWKSSlower, more complex key management
Private key never leaves auth serverRequires certificate/key rotation plan

Recommendation

  • Monolith / internal APIs → HS256 with strong secret (256+ bits)
  • Public APIs / OAuth / microservices → RS256 or ES256

Using HS256 vs RS256 — Which JWT Algorithm to Use? Safely

Algorithm HS256 vs RS256 — Which JWT Algorithm to Use? defines JWT signing. Validate the header alg matches expectations. Use JWKS for asymmetric keys; protect HMAC secrets.

Browse related resources: JWT Decoder, JWT Validator, JWT Basics, JWT Authentication, JWT Errors, Algorithms, Glossary, and Learning Path.

Try It Now

FAQ

What is HS256?

HMAC-SHA256 — symmetric algorithm using a shared secret for signing and verification.

What is RS256?

RSA-SHA256 — asymmetric algorithm using a private key to sign and public key to verify.

Which is more secure?

RS256 is better for distributed systems since only the auth server holds the private key.