JWT Generator — Sign a JWT with HS256, RS256 or ES256

🔒 Runs in your browser — nothing is sent to a server

JWT generator that produces a signed JSON Web Token from a JSON payload, a key and an algorithm in a single click. Fill in the claims you need — `sub`, `iat`, `exp`, custom fields — pick HS256/HS384/HS512 for symmetric HMAC signing or RS256/ES256 for asymmetric signing with an RSA or EC key. For asymmetric algorithms the generator can mint a fresh key pair in-browser and hand you the matching public key for your verifier. Everything runs 100% inside your browser through the Web Crypto API; your secret, private key and payload never leave your device.

Copied!

When to use a JWT generator

A JWT generator is the fastest way to mint a token for local work — reproducing a failing request in a test harness, seeding a fixture for an integration test, stubbing an authenticated request against a staging API, teaching a workshop on bearer-token auth, or simply verifying that a downstream service rejects an expired token. For production traffic the signing should happen inside your auth service; for every other case, a browser-local generator that never touches the network is ideal because your secret stays on your machine.

How JWT signing works under the hood

Signing a JWT is three operations in sequence. First the header (for example `{"alg":"RS256","typ":"JWT"}`) is JSON-stringified and base64url-encoded. Second the payload is JSON-stringified and base64url-encoded. Third the string `headerB64.payloadB64` is fed into the signing primitive: HMAC-SHA-256/384/512 for HS*, RSASSA-PKCS1-v1_5 with SHA-256 for RS256, or ECDSA on P-256 with SHA-256 for ES256. The Web Crypto API implements all three natively through `crypto.subtle.sign`, and `crypto.subtle.generateKey` mints fresh RSA-2048 or P-256 key pairs without bundling a crypto library. Your secret or private key goes straight into the browser crypto primitive and never leaves the tab.

Examples

Input
{
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
}
secret: your-256-bit-secret
Output
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Create JWT token — classic HS256 with three claims
Input
{
  "iss": "https://auth.free-converter.online",
  "aud": "api.kwezitgames.com",
  "sub": "user_42",
  "exp": 1750000000,
  "iat": 1749996400
}
secret: hmac-secret-for-testing
Output
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZnJlZS1jb252ZXJ0ZXIub25saW5lIiwiYXVkIjoiYXBpLmt3ZXppdGdhbWVzLmNvbSIsInN1YiI6InVzZXJfNDIiLCJleHAiOjE3NTAwMDAwMDAsImlhdCI6MTc0OTk5NjQwMH0.<signature>
Sign JWT HS256 — token with expiry and audience
Input
{
  "sub": "admin@free-converter.online",
  "roles": ["admin", "auditor"],
  "scope": "read write"
}
private key: -----BEGIN PRIVATE KEY----- (RSA-2048, PKCS#8)
Output
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbkBmcmVlLWNvbnZlcnRlci5vbmxpbmUiLCJyb2xlcyI6WyJhZG1pbiIsImF1ZGl0b3IiXSwic2NvcGUiOiJyZWFkIHdyaXRlIn0.<rsa-signature>
RS256 JWT generator — RSA signature over admin token
Input
{
  "sub": "admin@kwezitgames.com",
  "roles": ["admin"]
}
private key: -----BEGIN PRIVATE KEY----- (P-256, PKCS#8)
Output
eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbkBrd2V6aXRnYW1lcy5jb20iLCJyb2xlcyI6WyJhZG1pbiJdfQ.<ecdsa-r-s-signature>
ES256 JWT — short ECDSA signature over same claims

FAQ

How do I generate a JWT token online?

Enter your claims as JSON, pick an algorithm (HS256/HS384/HS512 for HMAC, RS256 or ES256 for asymmetric), provide the matching key and click Generate JWT. The generator base64url-encodes the header and payload, signs the `header.payload` string with your key via the Web Crypto API, and outputs the final `header.payload.signature` token. Nothing is uploaded.

How do I sign a JWT with HS256?

HS256 is HMAC-SHA256 with a shared secret. Paste the payload, put your secret in the Secret field, leave the algorithm set to HS256, and click Generate JWT. The browser's built-in `crypto.subtle.sign` computes the HMAC and emits the signed token. Pick HS256 whenever issuer and verifier share a symmetric key.

What is the difference between HS256 and RS256?

HS256 is symmetric — one shared secret signs and verifies. RS256 is asymmetric — a private RSA key signs, a matching public key verifies, and only the issuer ever holds the private half. Pick HS256 for quick fixtures and internal services; pick RS256 when verifiers should not be able to mint tokens themselves.

How do I generate an RSA or EC key pair for RS256 / ES256?

Select RS256 or ES256 in the algorithm dropdown and click the Generate new key pair button above the private key box. The generator calls `crypto.subtle.generateKey` for RSA-2048 (RS256) or P-256 EC (ES256), drops the PKCS#8 private key into the field, and opens a Public Key panel with the matching SPKI PEM that you can copy straight into your verifier.

What is ES256 and when should I use it?

ES256 signs JWTs with ECDSA on the P-256 curve and SHA-256. It produces much shorter signatures than RS256 for equivalent security (64 bytes vs 256 bytes) which keeps tokens compact — useful for cookies, high-throughput APIs and constrained clients. ES256 is the recommended asymmetric JWT algorithm in modern OAuth and OpenID Connect deployments.

What is the difference between HS256, HS384 and HS512?

All three are HMAC algorithms with the same flow — the only difference is the underlying SHA function: SHA-256, SHA-384 or SHA-512. Longer digests produce longer signatures but are not meaningfully "more secure" for realistic secrets. HS256 is the default in most libraries; pick HS384 or HS512 only if your identity provider or API contract specifies it.

Is this JWT generator safe to use with real secrets?

Yes — all signing and key generation happen inside your browser via the Web Crypto API, the secret, private key and payload never leave the page. JWTs minted for production should still be issued by your own auth service; this generator is intended for local testing, fixtures in test suites and teaching the shape of a JWT.

What claims should I include in my JWT payload?

At a minimum, most APIs expect `sub` (the subject/user id) and `iat` (issued-at). Add `exp` to bound the token's lifetime, `iss` and `aud` to describe issuer and audience, `nbf` to delay its validity, and any custom claims your service needs such as `roles`, `scope` or tenant ids. Keep the payload small — it travels inside every request.

Glossary

JWT (JSON Web Token)

A JWT is the compact token format defined by RFC 7519 — three segments joined by dots, where the first two are base64url-encoded JSON and the third is a cryptographic signature over them. A JWT generator assembles those three segments and signs them; a JWT decoder reverses the encoding to reveal the claims. JWTs are the default format for stateless API authentication.

HS256 (HMAC-SHA256)

HS256 is the JWT signing algorithm that computes an HMAC-SHA256 over `base64url(header).base64url(payload)` using a shared secret. It is the default in virtually every JWT library because it is fast, symmetric and needs no key distribution beyond the secret itself. Sign a JWT with HS256 by pasting a payload and a secret here; anything that knows the same secret can verify the result.

RS256 (RSA-SHA256)

RS256 signs JWTs with RSASSA-PKCS1-v1_5 and SHA-256. A private RSA key computes the signature; the matching public key verifies it. RS256 is the most widely supported asymmetric JWT algorithm and is the default in OpenID Connect and most enterprise SSO systems. Use it whenever verifiers (APIs, partners, clients) must not be able to mint tokens themselves.

ES256 (ECDSA-P256-SHA256)

ES256 signs JWTs with ECDSA on the NIST P-256 curve and SHA-256. It produces 64-byte signatures — roughly a quarter the size of an RS256 signature at equivalent cryptographic strength — so tokens stay compact. ES256 is supported natively by the browser Web Crypto API and is the recommended asymmetric JWT algorithm in modern OAuth and OpenID Connect profiles.

Asymmetric signing

Asymmetric signing uses two different keys: a private key known only to the issuer, and a public key shared with every verifier. RS256 and ES256 are the asymmetric JWT algorithms; HS256 is symmetric. Asymmetric signing is essential whenever the entity verifying a token should not be trusted to create new tokens — for example a downstream API accepting tokens issued by a central auth service.

PKCS#8 / SPKI PEM

PKCS#8 is the standard binary format for private keys; SPKI is the standard format for public keys. Both are wrapped in PEM — base64 text framed by `-----BEGIN PRIVATE KEY-----` or `-----BEGIN PUBLIC KEY-----`. The Web Crypto API's `importKey` accepts exactly these two formats, which is why this generator expects PKCS#8 private keys for signing and emits SPKI public keys for sharing with verifiers.

Related tools