Guide

THE TOOLBOX / SECURITY & AUTHENTICATION

JWT Generator —
Sign, Decode & Verify HS256, RS256 & ES256 Tokens Locally.

Generate, sign, and verify real RFC 7519 JSON Web Tokens using your browser's native Web Crypto API—supporting HMAC (HS256/384/512), RSA (RS256), and ECDSA (ES256) with zero server calls.

Signed JWT (HS256 · 0 chars)
..
■ Header■ Payload■ Signature

JWT SIGNING ALGORITHMS & RFC 7519 GUIDE

Choosing between HS256, RS256, and ES256 for API authentication.

AlgorithmKey TypeSignature SizeBest Use Case
HS256 / HS512Symmetric (Shared Secret)32 / 64 bytesSingle-service backends or internal microservices sharing one vault.
RS256Asymmetric (RSA-2048)256 bytesOAuth2 / OIDC identity providers publishing public JWKS endpoints.
ES256Asymmetric (ECDSA P-256)64 bytesModern high-throughput APIs needing compact asymmetric signatures.

1. Anatomy of a Signed JWT

Every compact JWT has three Base64URL-encoded segments separated by dots: header.payload.signature. The signature covers the exact ASCII string base64url(header) + "." + base64url(payload).

2. Always Pin Expected Algorithms

On your backend, explicitly whitelist the expected algorithm (e.g. ['RS256']) when verifying tokens to prevent alg: "none" and key-confusion attacks.

3. Short Access Tokens + Refresh Rotation

Keep stateless JWT access tokens short-lived (15 minutes to 1 hour via exp) and pair them with revocable refresh tokens stored in HttpOnly cookies.

Frequently Asked Questions

Is this JWT generator safe to use with real secrets or keys?

All HMAC, RSA-2048, and ECDSA P-256 key generation, signing, and verification run 100% locally in your browser using the native Web Crypto API—nothing is ever sent over the network. Still, as a security best practice, use dedicated test keys when debugging.

What is the difference between HS256, RS256, and ES256?

HS256 uses a shared symmetric secret (the same key signs and verifies). RS256 (RSA 2048-bit) and ES256 (ECDSA P-256) use asymmetric keypairs—a private key signs the token while any service can verify it using the public key without being able to forge tokens. ES256 produces much smaller signatures than RS256.

Are JWT payloads encrypted?

No. Standard JWS tokens (JSON Web Signatures) are only Base64URL-encoded and cryptographically signed to prevent tampering—anyone holding the token can decode the header and payload. Never put passwords or sensitive secrets inside a JWT payload.

What do iat, exp, sub, and iss mean in a JWT?

These are standard RFC 7519 registered claims: sub (Subject / user ID), iss (Issuer), aud (Audience), iat (Issued At Unix timestamp in seconds), and exp (Expiration Unix timestamp in seconds).

How long should an HS256 secret key be?

RFC 7518 requires an HS256 secret to be at least 256 bits (32 random bytes). Use the "Random 256-bit Secret" button to generate a cryptographically strong key via crypto.getRandomValues.

Can I verify tokens signed by my backend?

Yes. Switch to the "Decode & Verify JWT" tab, paste your token, and enter your HMAC secret (for HS256/HS384/HS512) or SPKI Public Key PEM (for RS256/ES256) to verify the signature locally.