Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

JWT Encoder

Create signed JWTs in your browser. Edit the header and payload, set iat and exp in one click, and sign with HS256, HS384, or HS512 — your secret never leaves the page.

Processed locally in your browser — nothing is uploaded.

JWT Encoder

36 characters

0 characters

Issue now, expire in

HS256 needs a secret of at least 32 bytes. Signed in your browser; the secret never leaves this page.

Token

The signed token appears here…

  • header
  • payload
  • signature

About JWT Encoder

Write a JWT's header and payload as JSON, enter the secret your server verifies with, and get the signed token as you type. The three parts are colour-coded — header, payload, signature — the same way the JWT Decoder shows them, so you can paste the result straight back in to check it.

Signing follows RFC 7519 and RFC 7515: the header and payload are serialized as compact JSON, Base64URL-encoded without padding, and joined with a dot, and that string is signed with HMAC-SHA-256, -384, or -512 using your browser's built-in Web Crypto. Any standard library — jsonwebtoken, PyJWT, jose, java-jwt — accepts the result with the same secret and algorithm.

  • One-click time claims. "Issue now, expire in" sets iat to the current time and exp that far ahead, as Unix seconds. The JWT Expiration Checker shows the same window for a token you already have.
  • The header follows the algorithm. Picking HS384 or HS512 rewrites alg in the header, and any other header fields you add, like kid, are signed as written.
  • Warnings before your server rejects it: a secret shorter than the algorithm's hash (RFC 7518 requires at least 32 bytes for HS256, 48 for HS384, 64 for HS512), exp or iat written as a string or in milliseconds, a token that is already expired, or exp earlier than iat.

If your secret is a Base64-encoded random key rather than a passphrase — as many jjwt and Spring setups configure it — switch Options → Secret encoding to Base64 so the token is signed with the decoded bytes.

Common uses

  • Mint a test token for a local API, Postman collection, or integration test without writing a script
  • Reproduce a token your auth server issues to debug a signature mismatch
  • Try what a verifier does with an expired, not-yet-valid, or wrongly signed token

Example

Input

Header:  {"alg":"HS256","typ":"JWT"}
Payload: {"sub":"1234567890","name":"John Doe","iat":1516239022}
Secret:  your-256-bit-secret

Output

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

This is jwt.io's well-known sample token, so you can compare. The tool also warns that the 19-byte secret is shorter than the 32 bytes HS256 calls for.

Limitations

  • HMAC (HS256, HS384, HS512) only: RS256, ES256, and other asymmetric algorithms need a private key and aren't supported
  • Unsigned tokens with alg "none" are deliberately not offered — they are what an attacker sends to a misconfigured verifier
  • It signs (JWS) but doesn't encrypt (JWE): anyone holding the token can read the payload, so never put secrets in claims
  • The JSON is signed in compact form, so whitespace and key order in the editor don't matter, but duplicate keys keep only the last value

Frequently asked questions

Is it safe to enter my JWT secret here?

The token is signed in your browser with Web Crypto, and neither the secret nor the claims are sent to a server or stored. Even so, treat a production signing key as you would a password: anyone who has it can mint tokens your API trusts, so use this with test or development secrets where you can.

How long should a JWT secret be for HS256?

At least 32 bytes (256 bits) for HS256, 48 bytes for HS384, and 64 bytes for HS512 — RFC 7518 requires a key at least as long as the hash output. It should also be random, not a word or phrase: a short or guessable secret can be brute-forced offline from any token it signed. The Generate button creates a random secret of the right size.

How do I set a JWT to expire in 1 hour?

Set the exp claim to the current Unix time in seconds plus 3600, and usually iat to the current time. Clicking 1 hour under the payload does exactly that. exp must be a number of seconds, not milliseconds or a date string, or verifiers will reject the token or treat it as never expiring.

What is the difference between HS256, HS384, and HS512?

All three sign with HMAC and a shared secret; they differ in the hash function — SHA-256, SHA-384, or SHA-512 — and therefore in signature length and minimum key size. HS256 is by far the most widely supported and is secure with a strong secret; pick the others only if your verifier expects them.

Why does my server say the signature is invalid?

Usually the secret differs in encoding rather than value: one side treats it as plain text and the other as Base64-decoded bytes, so compare with the Secret encoding option. Other causes are an algorithm mismatch between the token's alg and what the server expects, or trailing whitespace copied into the secret.