JWT Generator/Decoder
Generate and decode JSON Web Tokens. Encode with HMAC-SHA256 via Web Crypto API. Decode to see header, payload, and expiration status.
How to Use JWT Generator/Decoder
- 1Paste a JWT to decode, or switch to Encode mode.
- 2See the decoded header, payload, and claims.
- 3Check token expiration status.
- 4Generate new JWTs with custom claims and secret.
Zenovay
Privacy-first analytics for your website
Understand your visitors without invasive tracking. GDPR compliant, lightweight, and powerful.
Related Tools
Password GeneratorGenerate strong, random passwords with customizable length, characters, and complexity.
Password Strength CheckerCheck how strong your password is. Get an estimated crack time and improvement suggestions.
HMAC GeneratorGenerate HMAC signatures using SHA-256, SHA-384, or SHA-512 with the Web Crypto API.
AES Encryption/DecryptionEncrypt and decrypt text using AES-GCM with PBKDF2 key derivation. Runs entirely in your browser.
Frequently Asked Questions
What is a JSON Web Token (JWT)?▾
A JSON Web Token is a compact, URL-safe means of representing claims to be transferred between two parties. The claims are encoded as a JSON object that is digitally signed using HMAC or RSA. JWTs are widely used for authentication and information exchange in APIs and single-page applications.
What is the structure of a JWT?▾
A JWT consists of three Base64url-encoded segments separated by dots: Header.Payload.Signature. The Header specifies the algorithm (e.g., HS256) and token type. The Payload contains the claims (iss, sub, exp, etc.). The Signature is computed from the header and payload using the secret key, and is used to verify the token has not been tampered with.
What is the difference between JWT and session-based authentication?▾
Session-based authentication stores session data server-side (in a database or memory) and gives the client a session ID cookie. JWT is stateless — the token itself carries the claims, so the server needs no session store. JWTs are easier to scale across multiple servers and services, but cannot be easily revoked once issued unless you maintain a blocklist.
When should I use JWTs?▾
JWTs are well suited for stateless API authentication, microservices communication, single sign-on (SSO), and mobile app authentication. They are less ideal when you need immediate token revocation (e.g., logout invalidation) without a revocation list, or when the payload is large and adds overhead to every request.
What are the security concerns with JWTs?▾
Key concerns include: (1) Weak secrets — always use a long, random key for HMAC. (2) The "alg: none" attack — never accept tokens with no algorithm. (3) Storing JWTs in localStorage exposes them to XSS; prefer httpOnly cookies. (4) Long expiration times mean a stolen token stays valid — keep exp short and use refresh tokens. (5) Never put sensitive data in the payload — it is only Base64-encoded, not encrypted.