JWT Encoder
Sign and encode a JSON Web Token from a custom header, payload, and RSA or EC private key (RFC 7519).
Token Configuration
Generate a fresh key pair for the selected algorithm, entirely in your browser.
How JWT Encoding Works
Encoding a JWT means taking a JSON header and a JSON payload, base64url-encoding each one, and then signing over them using a private key. The resulting signature is appended as a third segment, giving you the familiar three-part dot-separated token: header.payload.signature.
Header
The header describes the token itself. The two most important fields are:
- alg: the signing algorithm. Must match your key type: RS256, RS384, or RS512 for RSA keys; ES256, ES384, or ES512 for EC keys.
- typ: token type. Use "JWT" for standard tokens. DPoP proofs use "dpop+jwt".
- kid: an optional key ID hint. Helps the recipient look up the correct public key from the issuer's JWKS endpoint.
Payload
The payload contains the claims, statements about the subject and any additional context. RFC 7519 registered claim names:
- iss (Issuer): who issued the token, typically the Authorization Server URL.
- sub (Subject): the principal the token is about, usually a user or service identifier.
- aud (Audience): intended recipient(s). Resource servers should reject tokens where they are not listed.
- exp (Expiration Time): Unix timestamp after which the token must not be accepted.
- iat (Issued At): Unix timestamp when the token was issued.
- nbf (Not Before): Unix timestamp before which the token must not be accepted.
- jti (JWT ID): unique identifier for the token, useful for preventing replay attacks.
Any fields beyond the registered names are custom claims, for example scope, roles, or application-specific context. The payload is base64url-encoded, not encrypted, so never put secrets here.
Signature
The signature is computed by the issuer over the encoded header and payload using the private key indicated by alg. It proves the token was issued by the expected party and has not been tampered with. Only the corresponding public key can verify it; this is the foundation of asymmetric JWT security. Never share a private key; once a token is signed, keep the private key safe.
Supported Algorithms
This tool supports PKCS#8 PEM-encoded keys with the following algorithms:
- RS256, RS384, RS512: RSA with SHA-2. Most common for OAuth 2.0 access tokens and ID tokens.
- ES256, ES384, ES512: ECDSA with P-256, P-384, or P-521 curves. Smaller keys and signatures than RSA.
The alg value in the header must match your key type. Mismatches will produce a clear error message.
Prefer not to bring your own key? Use the Generate a Key tab; it creates a matching key pair for the selected algorithm locally in your browser.