JWT Builder

JWT Builder

Build and sign a JSON Web Token. All signing runs in your browser.

Algorithm
Header (auto-updated)
Payload
Secret key (for HMAC)

About the JWT Builder

When you are developing or testing an API protected by JSON Web Tokens, you often need a token with specific claims: an expired one, one with an admin role, one for a different tenant. Waiting for an identity provider to issue each variation slows everything down.

The JWT Builder lets you write the payload as JSON, choose an HMAC algorithm (HS256, HS384 or HS512), enter a secret, and generate a correctly signed token. The header updates automatically, the token is broken down into its colour-coded parts, and you can open it in the JWT Decoder with one click. Signing uses your browser's built-in Web Crypto API, so the secret never leaves your device.

Common uses

  • Creating test tokens for local development of an API that validates HS256 tokens.
  • Writing automated tests for expired, not-yet-valid or wrongly scoped tokens.
  • Reproducing an authorisation bug with the exact claims a user had.
  • Learning how the signature depends on the header, payload and secret.

How to use it

  1. Choose the Algorithm.
  2. Edit the Payload JSON — for example sub, role and exp.
  3. Enter the Secret key your API uses. Tick Secret is Base64-encoded if your configuration stores it that way.
  4. Press Generate JWT and copy the token into an Authorization: Bearer header.

Example

A short-lived test token for an admin user:

Input
Algorithm: HS256
Payload:   { "sub": "42", "role": "admin", "exp": 1893456000 }
Secret:    my-local-dev-secret-at-least-32-bytes
Output
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiIsInJvbGUiOiJhZG1pbiIsImV4cCI6MTg5MzQ1NjAwMH0.<signature>

Tips and common pitfalls

  • Use a secret of at least 256 bits (32 random bytes) for HS256. Short or guessable secrets can be brute-forced from a single token.
  • Never use production secrets in any web tool. Keep separate keys for development and test environments.
  • exp, nbf and iat are Unix timestamps in seconds, not milliseconds. Use the Timestamp Converter to pick values.
  • If your API rejects the token, check that the secret encoding matches: a Base64 secret and the same text used as raw bytes produce different signatures.

Frequently asked questions

Does the builder support RS256 or ES256?

This builder signs with shared-secret HMAC algorithms (HS256, HS384, HS512), which are the most common for local development. Asymmetric algorithms need a private key and are normally issued by your identity provider.

Is my secret sent anywhere?

No. The token is signed in your browser with the Web Crypto API; neither the payload nor the secret is transmitted.

Why does my API say the signature is invalid?

The most common causes are a different secret, a mismatch between Base64 and plain-text secret handling, or an algorithm the API does not accept.

Can I create a token without a signature?

Unsigned tokens (alg: none) are a well-known security risk and should be rejected by every API, so the builder always signs.

Related