JWT Encoder

Runs locally

Create and sign a JSON Web Token locally — HS, RS, PS, ES and EdDSA.

Header

Secret

Stays in this tab — never saved or sent.

Use at least 32 random bytes for HS256.

Payload

The payload is only Base64URL-encoded, not encrypted: anyone with the token can read it.

Signed token

Signing…

Guide

Signing a test token without handing your key to a website

Testing an API that expects a JWT means producing tokens with specific claims: an expired one, one for another audience, one with an extra scope. This encoder builds them locally. The header and payload are serialised as JSON, Base64URL-encoded and joined with a dot; that string is signed with Web Crypto and the signature appended. The secret or private key lives only in this component’s memory — it is not written to storage, put in the URL or sent anywhere, and it is gone when you close the tab.

HS algorithms use a shared secret, which the API needs too; RFC 7518 requires at least as many random bytes as the hash, so 32 for HS256, and the Random secret button makes one. RS, PS, ES and EdDSA use a private key to sign and the public key to verify. Paste a PKCS#8 PEM (BEGIN PRIVATE KEY), a PKCS#1 RSA key or a private JWK, or generate a test key pair: the public half appears alongside so you can configure the API or verify the token in the decoder.

Times in JWTs are Unix seconds. iat = now and the exp buttons write the right numbers for you; for a specific moment, get it from the Timestamp Converter. Remember that anyone can read the payload — sign test data, not real personal information.

Header, payload and secret

{"alg":"HS256","typ":"JWT"}
{"sub":"42","exp":1767229200}
secret: devpocket-demo-secret

Signed token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiIsImV4cCI6MTc2NzIyOTIwMH0.MFUOH3wQhlEK3CSbpIwxoL6m-90LGY72SJNFciVHNNY

exp 1767229200 is 2026-01-01T01:00:00Z. Change a space in the JSON and the middle segment — and the signature — change with it.

Where people get caught

Short or guessable HS256 secrets

HMAC secrets can be brute-forced offline from a single token. Use 32 random bytes or more, never a word or a password.

Signing with the wrong key type

RS256 needs an RSA private key, ES256 a P-256 EC key. A key of another type fails to import; the error names what was expected.

SEC1 EC keys

Keys that begin "BEGIN EC PRIVATE KEY" must be converted to PKCS#8 first: openssl pkcs8 -topk8 -nocrypt -in key.pem.

Forgetting exp

A token without exp is valid forever unless the API enforces its own limit. Add one, even to test tokens.

About signing JWTs

How it works in 4 steps · 4 common use cases · 4 questions answered

How it works

  1. 1.Choose the algorithm; the header’s alg follows.
  2. 2.Edit the payload and use the iat and exp buttons for times.
  3. 3.Paste a secret or private key, or generate a test one.
  4. 4.Copy the signed token or open it in the JWT decoder.

Common use cases

  • •Testing how an API handles expired or not-yet-valid tokens
  • •Producing tokens with extra scopes or roles for local development
  • •Checking that a service accepts RS256 tokens from a new key pair
  • •Demonstrating JWT structure in a code review or a workshop

FAQ

Is my signing key sent anywhere?

No. Signing uses Web Crypto in this tab. The key is kept only in memory — not in storage, the URL or any request — and disappears when you close the page.

Which algorithms can it sign with?

HS256, HS384 and HS512 with a secret; RS256/384/512 and PS256/384/512 with an RSA key; ES256, ES384 and ES512 with an EC key; and EdDSA (Ed25519) where the browser supports it.

How do I make a token that expires in an hour?

Press "exp +1 hour". It sets iat to the current time if it is missing and exp to now plus 3,600 seconds.

Can it create unsigned (alg: none) tokens?

No. Unsigned tokens are a common attack, and APIs should reject them, so the encoder always signs.