TurantToolsdev</> All tools

HS256 or RS256 for Your JWTs?

Shared secret vs public key signing, when each fits, and the checks every verifier must make.

By the TurantTools Dev team · Updated October 27, 2026 · 3 min read

Most JWTs are signed with HS256 or RS256 (or ES256). The choice comes down to who needs to verify the token.

HS256 (HMAC)RS256 / ES256 (public key)
KeysOne shared secretPrivate key signs, public key verifies
Who can verifyAnyone with the secret, who can also create tokensAnyone with the public key, who can't create tokens
Good forOne service that issues and checks its own tokensMany services, or third parties, verifying tokens from one issuer
Key sharingMust be kept secret everywhere it's usedPublic keys can be published (JWKS)

Checks every verifier must make

  1. Pin the expected algorithm; never trust the token's own alg header, and reject none.
  2. Check exp, nbf, the issuer (iss) and the audience (aud).
  3. For HS256, use a random secret of at least 256 bits, not a word or a short string.
JWT Decoder & Expiry CheckerInspect a token's header and claims.

Sources we checked

More articles