DevNb

Encoding & Hashing/JWT Encoder

JWT Encoder & Generator

Edit the header and payload, choose an algorithm, and get a signed JSON Web Token instantly. Generate a key pair or use your own. Everything runs in your browser and nothing leaves your device.

Tokens are signed locally with the Web Crypto API. Your claims, secret and private key never leave your browser, and secrets and keys are never saved to history.

HMAC using SHA-256

Header4 lines36 chars
Add claim:
Payload7 lines110 chars
Encoded token0 chars
Your signed JWT appears here.
  • Header
  • Payload
  • Signature

How a JWT is created

A signed JWT (a JWS, defined in RFC 7515) is built in three steps. The header and payload JSON are each Base64URL-encoded, joined with a dot, and that string is signed with the chosen algorithm. The Base64URL-encoded signature is then appended: header.payload.signature.

HMAC algorithms (HS256, HS384, HS512) use one shared secret to both sign and verify. RSA, ECDSA and EdDSA algorithms use a private key to sign and a public key to verify, so you can publish the public key without letting anyone forge tokens. This tool shows the public key that matches your private key so you can hand it to whatever verifies the token.

Common claims

Use the quick buttons above the payload to add iat (issued at), exp (expires in one hour), nbf (not before) and jti (unique ID). Date claims are NumericDate values: whole seconds since 1 January 1970 UTC, not milliseconds.

FAQ

Is my payload, secret or private key sent to a server?

No. The token is built and signed in your browser with the Web Crypto API. Nothing is uploaded. Only the algorithm, header and payload are kept in your local history; secrets and private keys are never saved.

Which signing algorithms are supported?

HS256, HS384 and HS512 (shared secret), RS256, RS384 and RS512 (RSA), PS256, PS384 and PS512 (RSA-PSS), ES256, ES384 and ES512 (ECDSA on P-256, P-384 and P-521), EdDSA (Ed25519, in browsers that support it), and the unsecured none algorithm for testing.

What private key formats can I paste?

PKCS#8 PEM ("BEGIN PRIVATE KEY"), RSA PKCS#1 PEM ("BEGIN RSA PRIVATE KEY") or a private JWK. Encrypted keys and SEC1 "EC PRIVATE KEY" PEM files are not supported by Web Crypto; convert them first with openssl pkcs8 -topk8 -nocrypt. You can also click Generate new key pair to create a throw-away RSA-2048, P-256, P-384, P-521 or Ed25519 key pair.

How do I verify the token I created?

Copy the token into the JWT Decoder and enter the same secret for HMAC algorithms, or the public key shown under the token for RSA, ECDSA and EdDSA algorithms. The decoder then reports whether the signature is valid.

How long should an HMAC secret be?

RFC 7518 requires the key to be at least as long as the hash output: 32 bytes for HS256, 48 bytes for HS384 and 64 bytes for HS512. The tool warns you when the secret is shorter. Use a long random value and never reuse a real production secret in an online tool.

Why does the header change when I pick an algorithm?

The alg member of the header must match the algorithm used to sign the token. Choosing an algorithm updates the header, and editing alg in the header switches the algorithm. If they disagree the tool shows an error instead of producing a misleading token.

Need to inspect or verify a token? Try the JWT Decoder β†’