How to use it
- Paste the claims as a JSON object in the left pane, for example
{"sub": "usr_1024", "role": "admin"}. - Pick an Algorithm. For HS256, HS384 and HS512 enter the Secret. For RS256, RS384, RS512, PS256, ES256 and ES384 paste a Private key (PEM) in PKCS#8 format.
- Optionally turn on Add iat/exp.
iatis set to the current time andexpto now plus the chosen lifetime (15 minutes to 7 days, or noexp). Existingiat/expclaims are replaced, and the tool tells you so. - Copy the token on the right. Reverse opens it in the JWT Decoder, where you can check the claims and verify an HMAC signature.
Under More options, Key ID (kid) adds a kid header so the verifier can pick the right key from a JWKS.
What the tool builds
A signed JWT (JWS compact form, RFC 7515) is three Base64URL parts joined by dots: header.payload.signature. The header is always {"alg":"…","typ":"JWT"} (plus kid if set). The payload is your JSON minified but otherwise unchanged: key order, string escapes and big integers such as 9007199254740993 are kept exactly as written. The signature is computed over the ASCII bytes of header.payload.
With the default sample and the demo secret tidypane-demo-secret, the output is:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfMTAyNCIsIm5hbWUiOiJMaW5oIE5ndXllbiIsInJvbGVzIjpbImFkbWluIl0sImlhdCI6MTc5MDAwMDAwMCwiZXhwIjo0MTAyNDQ0ODAwfQ.Us8PA09L_X4abNQmR9j9uXU6jzJbxijo5W_QJNQxR5I
The tool warns that the demo secret is public. Replace it before you use a token anywhere. The classic jwt.io example ({"sub":"1234567890","name":"John Doe","iat":1516239022} with the secret your-256-bit-secret) produces exactly the well-known token ending in SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c, which is how the tests check the HMAC path.
Algorithms and keys
- HS256/384/512: HMAC with SHA-2. The secret is used as UTF-8 bytes.
- RS256/384/512: RSASSA-PKCS1-v1_5. PS256: RSASSA-PSS with SHA-256 and a 32-byte salt, as RFC 7518 requires. Both need an RSA key of at least 2048 bits. A smaller key is still accepted, with a warning.
- ES256/ES384: ECDSA on P-256/P-384. The signature is the fixed-length
r‖spair (64 or 96 bytes) that JWS requires, not the DER encoding thatopenssl dgst -signprints.
You don’t have a key yet? The Key Pair Generator makes RSA and EC keys in the right PKCS#8 format. You can paste its whole output: the tool picks out the PRIVATE KEY block and skips the public key and comment lines. Newlines lost when you paste into the single-line field are fine too.
Common errors
- “This is a PKCS#1 RSA key”. Convert it with
openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem. - “This private key is password-protected”. Run
openssl pkey -in key.pem -out key-plain.pem, enter the passphrase, and paste the result. - “This is an EC P-256 key, but RS256 needs an RSA key”. The key type and the algorithm must match. The message tells you which algorithm fits the key.
- “The payload is not valid JSON”. The error shows the line and column, for example
Unexpected 't': expected a value.at line 1, column 23 for{"sub": "1", "admin": tru}. - “looks like milliseconds”. JWT times are seconds since 1970.
Date.now()returns milliseconds, so divide it by 1000.
Error messages never repeat your secret or key material.
Equivalent code
// Node.js with jose
import { SignJWT } from 'jose';
const secret = new TextEncoder().encode(process.env.JWT_SECRET);
const token = await new SignJWT({ sub: 'usr_1024' })
.setProtectedHeader({ alg: 'HS256', typ: 'JWT' })
.setIssuedAt()
.setExpirationTime('1h')
.sign(secret);
# Python with PyJWT
import os, time, jwt
now = int(time.time())
token = jwt.encode({"sub": "usr_1024", "iat": now, "exp": now + 3600}, os.environ["JWT_SECRET"], algorithm="HS256")
To check a password before you issue a token, see the Bcrypt Generator. For random secrets, use the Password Generator with 32 or more characters.
Frequently asked questions
Is the payload of a signed JWT encrypted?
No. The header and payload are only Base64URL-encoded, so anyone holding the token can read every claim. The signature proves who issued the token and that it was not changed. Never put passwords, card numbers or other secrets in the payload.
Which algorithm should I pick?
Use HS256 when the same service issues and checks the token and you can share a strong secret. Use RS256 or ES256 when other services must verify tokens without being able to create them: they only need the public key. ES256 tokens and keys are much smaller than RSA ones.
Why does my RSA key fail with "BEGIN RSA PRIVATE KEY"?
That header means PKCS#1, an older RSA-only format. Web Crypto only imports PKCS#8 (BEGIN PRIVATE KEY). Convert it once with openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem and paste the new file. The same command converts SEC1 EC keys (BEGIN EC PRIVATE KEY).
How long should an HMAC secret be?
At least as long as the hash: 32 bytes for HS256, 48 for HS384 and 64 for HS512 (RFC 7518, section 3.2). The tool warns when the secret is shorter. Generate it randomly instead of using a word or phrase.
Are my secret and private key sent anywhere?
No. Signing runs in your browser with the Web Crypto API. The secret and key fields are never saved on the device or put into share links, and the tool keeps no draft of the payload.
Last updated