Youโ€™re the Expert!

Menu

Workstation DEV-02 Zero-Knowledge WebCrypto

JWT Inspector, Expiry Timer & HMAC Signer

Decode JWT tokens, check claim expiration in real time, and verify or sign HS256/384/512 signatures locally in your browser.

HMAC Signature Verify & Sign

Enter a valid token & secret to verify signature
HEADER (Algorithm & Token Type) โ€”
PAYLOAD (Claims & Data) No exp claim

Beginner-Friendly Guide: How JWT, Base64Url & HMAC Work

1. What Is a JWT? (The VIP Wristband Analogy)

Think of a JWT (JSON Web Token) like a tamper-evident VIP pass issued when you log in. Instead of looking up your session in a database on every click, the server hands your browser a compact string with three dot-separated parts:

HEADER.PAYLOAD.SIGNATURE
  • Header: Label saying "This is a JWT signed with HS256".
  • Payload: Your claimsโ€”e.g. user ID (sub), name, role, and expiry time (exp).
  • Signature: A mathematical wax seal proving nobody altered the header or payload.

2. How HMAC (HS256 / 384 / 512) Secures It

HMAC mixes the Header + Payload with a private Secret Key inside a one-way cryptographic blender (SHA-256, SHA-384, or SHA-512):

HMAC_SHA256(base64Url(header) + "." + base64Url(payload), secret)

If a hacker changes even one letter in the Payload (e.g., "role": "admin"), the signature stops matching unless they know your Secret Key. Note: Without the secret key, you can still read the Header & Payload, you just cannot verify or forge the signature.

3. Different Ways Data Is Encoded (Encoding โ‰  Encryption)

  • Plain JSON: Human-readable text like {"user":"bheem"}, unsafe inside URLs because of spaces, quotes, and braces.
  • Standard Base64: Turns bytes into Aโ€“Z, aโ€“z, 0โ€“9, plus +, /, and = padding.
  • Base64Url (Used by JWT): Same as Base64, but swaps + โ†’ -, / โ†’ _, and removes = so tokens travel cleanly inside URLs and HTTP headers.
  • Important Rule: Base64Url is like writing in Pig Latinโ€”anyone can decode it. Never put passwords or card numbers inside a standard JWT payload!

4. How to Use Each Section on This Page

  1. Encoded Token (Top Left): Paste any eyJ... token to see its color-coded 3 parts immediately. If invalid, Header & Payload clear automatically.
  2. Header & Payload (Right): Inspect decoded JSON, check standard claims (iss issuer, sub user, iat issued at, exp expiry), and watch the live expiration badge.
  3. HMAC Verify & Sign (Bottom Left): Type your secret key to check if the token is authenticโ€”or edit the JSON on the right and click Sign & Mint New JWT to create a fresh test token.

5. Simple Python Example (Create & Verify a JWT)

Requires: pip install PyJWT
import jwt, time

secret = "dholakpur-laddoo-secret"
payload = {"sub": "chhota_bheem", "role": "defender", "exp": int(time.time()) + 3600}

# 1. Create (Sign) a JWT
token = jwt.encode(payload, secret, algorithm="HS256")
print("JWT:", token)

# 2. Verify & Decode (raises error if tampered or expired)
decoded = jwt.decode(token, secret, algorithms=["HS256"])
print("Verified User:", decoded["sub"])
Copied!


Pynfinity
Install Pynfinity Add to home screen for the best experience