JWT Encoder

Create and sign a JSON Web Token (JWT) from a custom header, payload, and secret, instantly in your browser. Build a test token for a local API, set an expiration claim, or reproduce a token to debug a signature mismatch, with no data sent to a server.

Related tools

An empty secret still produces a signed token, but anyone could forge one the same way.

Encoded JWT

Usage examples

Building a test token for a local API

Edit the payload to add claims like 'sub' or 'role', type a test secret, and paste the resulting token straight into your API client's Authorization header.

Learning how a JWT is put together

Change a single character in the header or payload and watch the encoded token change completely — a hands-on way to see how header.payload.signature fits together.

Reproducing a token to debug a signature mismatch

If your backend rejects a token as invalid, rebuild the same header and payload here with the same secret and compare the output byte for byte.

Setting an expiration claim and checking it decodes correctly

Add an 'exp' claim as a Unix timestamp (e.g. 1735689600) alongside 'iat', generate the token, then verify the encoded payload reflects exactly the claims you typed.

Showing a teammate why a JWT isn't encrypted

Build a token with a payload like {"sub":"user123","role":"admin"}, then point out that the middle segment is just base64url — anyone can decode it without the secret, so it should never hold sensitive data.

Quick reference

Common JWT headers (compact JSON)

HeaderBase64URL
{"alg":"HS256","typ":"JWT"}eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"HS384","typ":"JWT"}eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9
{"alg":"HS512","typ":"JWT"}eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
{"alg":"RS256","typ":"JWT"}eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"RS384","typ":"JWT"}eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9
{"alg":"RS512","typ":"JWT"}eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9
{"alg":"ES256","typ":"JWT"}eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"ES384","typ":"JWT"}eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9
{"alg":"ES512","typ":"JWT"}eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9
{"alg":"PS256","typ":"JWT"}eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9
{"alg":"PS384","typ":"JWT"}eyJhbGciOiJQUzM4NCIsInR5cCI6IkpXVCJ9
{"alg":"PS512","typ":"JWT"}eyJhbGciOiJQUzUxMiIsInR5cCI6IkpXVCJ9
{"alg":"EdDSA","typ":"JWT"}eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9
{"alg":"none","typ":"JWT"}eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0

HS256 examples (header {"alg":"HS256","typ":"JWT"})

PayloadSecret keyEncoded JWT
{"sub":"1234567890","name":"John Doe","iat":1516239022}your-256-bit-secreteyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
{"sub":"1234567890","name":"Jane Doe","iat":1700000000}secreteyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwiaWF0IjoxNzAwMDAwMDAwfQ.NpjVpQE-DqWK88Un6OChLABsDC7xvMiGcogGmseEwt4

Frequently asked questions

Is it safe to type my real production secret here?

Everything runs entirely in your browser and nothing is sent to a server — but pasting a real production secret into any client-side web tool still isn't best practice for live, sensitive systems. This tool is best suited for testing, debugging, and learning how JWTs work, not for generating tokens signed with secrets that protect real production systems.

Which signing algorithms are supported?

Currently only HS256 (HMAC-SHA256), set via the header's 'alg' field. Asymmetric algorithms like RS256 or ES256 need a private key pair rather than a single shared secret, which is out of scope for this tool right now.

Why does my token change every time I edit the payload?

The signature covers both the header and the payload, so changing either one — even a single character — produces a completely different signature and therefore a different token.

I'm getting an invalid JSON error.

The header and payload fields must each contain valid JSON objects, like {"alg":"HS256","typ":"JWT"}. Check for missing commas, unmatched braces, or unquoted keys.

Does this tool send my data anywhere?

No. Signing happens locally using your browser's built-in Web Crypto API. The header and payload JSON are saved to your browser's local storage so you can pick up where you left off, but the secret key is never saved anywhere.

Is the payload encrypted?

No, and this is the single most common misunderstanding about JWTs. The payload is base64url-encoded, not encrypted — it's trivial for anyone to decode and read, including browser extensions, proxies, or anyone who intercepts the token. The signature only proves the token wasn't tampered with; it does nothing to hide the payload's contents. Never put passwords, raw card numbers, or other secrets in a JWT payload.

What's the difference between 'iat', 'exp', and 'nbf'?

These are standard registered claims from RFC 7519, each holding a Unix timestamp (seconds since epoch). 'iat' (issued at) records when the token was created. 'exp' (expiration) marks when it should stop being accepted. 'nbf' (not before) marks when it starts being valid — useful for tokens that shouldn't be honored until some future moment. None of these are enforced by this tool; a real server-side verifier is what actually checks them.