JWT Generator

Build and sign JSON Web Tokens with custom claims and algorithms

JSON
{
  "alg": "HS256",
  "typ": "JWT"
}
JSON
{}
Click "Generate Token" to create a JWT

How JWT Generation Works

Understanding the process of creating secure tokens

Header

The header specifies the signing algorithm (e.g., HS256) and the token type. It is Base64URL-encoded to form the first part of the JWT.

Payload

The payload contains claims about the entity (typically the user) and additional metadata like expiration time, issuer, and custom data.

Signature

The signature is created by signing the encoded header and payload with a secret key using the specified algorithm, ensuring token integrity.

Creating tokens for testing

What this is for

Generated tokens are useful for exercising your verification path: checking that your API rejects an expired token, that it validates aud, that a missing role produces a 403 rather than a 500. Building those cases by hand against a live authorization server is slow and hard to control.

What they are not for is production. A token you sign here is only as trustworthy as the secret you typed into a web page. Use your real authorization server for anything that matters.

Choosing an algorithm

HS256 uses one shared secret to both sign and verify. Simple, but every party that can verify can also mint — so it only works when issuer and verifier are the same trust domain. Use a secret with real entropy; a short human-chosen string is brute-forceable offline once an attacker has a single token.

RS256 and ES256 sign with a private key and verify with the public one. This is what OAuth2 providers use, because verifiers only ever hold the public half and cannot forge tokens. ES256 produces noticeably smaller signatures than RS256, which matters if your tokens travel in headers.

Claims to set for realistic tests

At minimum iss, sub, aud, iat, and exp. Timestamps are seconds since epoch — the single most common mistake here is passing milliseconds, which produces a token valid for roughly fifty thousand years.

To test rejection paths, set exp in the past, set aud to a value your API doesn't accept, or omit a claim your code assumes is present. That last case catches a surprising number of crashes in code that reads claims without checking they exist.

Frequently asked questions

No. Sign production tokens with your authorization server, using keys stored in a secrets manager or HSM. Tokens from this tool are for local testing and fixtures only.

No. Signing uses the Web Crypto API in your browser and nothing is transmitted to our servers. Even so, avoid pasting production keys into any web page as a matter of habit.

At least 256 bits of entropy — 32 random bytes. RFC 7518 requires a key at least as long as the hash output for HMAC. A memorable passphrase is not sufficient; an attacker with one token can brute-force a weak secret offline with no rate limiting.

Set exp to a Unix timestamp in seconds. For a token valid one hour from now, that is the current epoch seconds plus 3600. To test expiry handling, set it to any value in the past — most libraries will reject it immediately.

Check aud and iss first, as those are validated separately from the signature and produce similar-looking errors. Then confirm your API is verifying with the matching key, and that the algorithm you signed with is in its accepted-algorithms allowlist.

Generating test tokens by hand?

Useful for a fixture, painful as a system. AuthAction issues real signed tokens against your own API servers and audiences.

Free, unlimited users. No credit card required.