JWT Generator (HS256)

Sign HS256 JSON Web Tokens in your browser with Web Crypto.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

Generate a signed HS256 JWT

Testing an API that expects a Bearer token often means hand-signing a JWT. This tool builds and signs a JSON Web Token with the HS256 (HMAC-SHA256) algorithm in your browser: provide a JSON payload and a shared secret, and it emits a standard header.payload.signature token ready to drop into an Authorization: Bearer header.

How it works

A JWT is built from three parts, each step running locally via the Web Crypto API:

  1. Header — fixed to {"alg":"HS256","typ":"JWT"} and Base64URL-encoded.
  2. Payload — your JSON claims, Base64URL-encoded.
  3. SignatureHMAC-SHA256(header + "." + payload, secret), Base64URL-encoded.

The three parts are joined with dots to produce the final token. The same secret is required to verify the token later, since HS256 is symmetric.

Example

A payload of { "sub": "1234", "name": "Sam" } signed with the secret my-secret produces a token of the form:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0Iiwi...
.<signature>

The first segment decodes to the header, the second to your payload, and the third is the HMAC signature that any party holding my-secret can recompute to verify the token.

The signing uses the browser’s native Web Crypto API — your secret and claims never leave the page, so it is safe for local development and integration testing.

Ad placeholder (rectangle)