DevGrill

JWT Encoder

Create signed JWTs (HS, RS, PS or ES) with your claims and expiry, in your browser.

Runs in your browser

Token
Enter a secret to sign the token.

Signed in your browser with WebCrypto. Secrets and keys are never stored or sent anywhere, and this tool has no share links.

Making test tokens

When you build or test an API that uses JWTs, you often need a token with exact claims: a particular user, a role, an expiry five minutes from now, or one that's already expired. Write the payload as JSON, pick an algorithm, add the secret or private key, and get a signed token you can paste into a request.

All the usual algorithms work: HMAC (HS256, HS384, HS512) with a shared secret, RSA (RS* and PS*) and ECDSA (ES256, ES384) with a private key. Signing uses your browser's built-in WebCrypto, so secrets and keys stay on your device. For RSA and ECDSA you can generate a throwaway key pair, and the token is checked against the public key so you know it verifies.

How to use the JWT Encoder

  1. Write the payload. Your claims as JSON. Set iat + exp adds the issue time and an expiry you choose.

  2. Pick the algorithm. Use the one your API expects, usually HS256 or RS256.

  3. Add the key. A secret for HS algorithms (text or Base64), or a PKCS#8 private key for the others, or generate a test one.

  4. Copy the token. Use it as Authorization: Bearer <token>, or open it in the JWT Decoder.

Tips

  • For HS256, use a secret of at least 32 random bytes. Short or guessable secrets let anyone forge tokens.
  • Times are in seconds since 1970 (Unix time). To test expiry handling, set exp in the past.
  • Don't sign production tokens with real production keys in any website, this one included; use test keys for test tokens.

Frequently asked questions

Is my secret or private key sent anywhere?

No. Signing happens in your browser with WebCrypto. Keys aren't stored, and the tool has no share links.

My key starts with BEGIN RSA PRIVATE KEY. Why doesn't it work?

Browsers need keys in PKCS#8 format (BEGIN PRIVATE KEY). Convert it with openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem.

What's the difference between RS256 and PS256?

Both use RSA keys. RS256 uses the older PKCS#1 v1.5 padding, which every library supports; PS256 uses PSS padding, which is more modern. Use whichever your API expects.

Can it make unsigned tokens (alg: none)?

No, on purpose. Unsigned tokens are a classic security hole; a server should never accept them.

Related tools