Skip to main content
Uttir

JWT Sign (HS256 / RS256)

Sign a JSON Web Token with HS256 (HMAC shared secret) or RS256 (RSA private key). Output is a standard compact JWT (header.payload.signature).

JWT Sign (HS256 / RS256) — A JSON Web Token (JWT) is three base64url segments: header.payload.signature. The header says which algorithm to use; the payload is your claims; the signature is the HMAC or RSA signature over the first two segments.

Signing runs entirely in your browser. The HMAC secret and RSA private key never leave this device.

Was JWT Sign (HS256 / RS256) useful?

What is JWT Sign (HS256 / RS256)?

A JSON Web Token (JWT) is three base64url segments: header.payload.signature. The header says which algorithm to use; the payload is your claims; the signature is the HMAC or RSA signature over the first two segments.

This tool builds the header and payload in the browser, then signs with Web Crypto (HMAC for HS256, RSASSA for RS256). Nothing is sent to a server.

How to use it

  1. Pick the algorithm

    HS256 is a shared secret; pick it if both sides have the same secret. RS256 is asymmetric; pick it if the verifier only has a public key.

  2. Add claims

    Standard claims: sub (subject), iss (issuer), aud (audience), exp (expiration, Unix seconds), iat (issued at). Or add your own custom claims.

  3. Provide the key

    HS256: a shared secret string. RS256: paste a PKCS#8 PEM private key (including the BEGIN / END lines).

Examples

Sign a local HS256 test token

Mint a standard compact three-part JWT from header JSON, payload claims, and an HMAC secret.

Header: {"alg":"HS256","typ":"JWT"} | Payload: {"sub":"user_42","role":"editor","iat":1735689600} | Secret: dev-secret-key

Result: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzQyIiwicm9sZSI6ImVkaXRvciIsImlhdCI6MTczNTY4OTYwMH0.WW7d9EGaa6wYb8PEbHwj-b6Gmo7_RPzrjOyYZwqar1w

Sign an asymmetric RS256 service assertion

Sign short-lived service claims locally using a PKCS#8 RSA private key without uploading credentials.

Header: {"alg":"RS256","typ":"JWT"} | Claims: {"iss":"auth-local","sub":"svc-billing","exp":1893456000} | Private Key: PKCS#8 PEM

Result: Compact header.payload.signature token verifiable in JWT Decoder or any JWKS consumer.

Frequently asked questions

Related guides

Related tools