Invalid token
HS256
HEADER_NO_DATA
NO_DATA
How JSON Web Tokens work, structure validation, signature verification, and security best practices
xxxxx.yyyyy.zzzzz). Each part has a specific purpose:| Part | Purpose | Example content | Encoding | Required |
|---|---|---|---|---|
| Header | Specifies token type and signature algorithm | {"alg":"HS256","typ":"JWT"} | Base64Url | Yes |
| Payload | Contains user claims | {"sub":"1234567890","name":"John Doe","iat":1516239022} | Base64Url | Yes |
| Signature | Cryptographic integrity verification | HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret) | Base64Url | Yes |
| Algorithm | Type | Key size | Performance | Security level | Use case | Standard |
|---|---|---|---|---|---|---|
| HS256 / HS384 / HS512 | Symmetric (HMAC) | 256-512 bits | Fastest (1.0x) | 128-256 bits | Single server, trusted environment, internal APIs | RFC 7518 |
| RS256 / RS384 / RS512 | Asymmetric (RSA) | 2048-4096 bits | Medium (3-5x slower) | 112-152 bits | Distributed systems, microservices, external clients | RFC 7518 |
| ES256 / ES384 / ES512 | Asymmetric (ECDSA) | 256-512 bits | Fast (1.2x) | 128-256 bits | Modern systems, resource-constrained devices, IoT | RFC 7518 |
| PS256 / PS384 / PS512 | Asymmetric (RSA-PSS) | 2048-4096 bits | Medium-slow (4-6x) | 128-256 bits | Higher security requirements (future-proof) | RFC 7518 |
| none | No security | N/A | No verification | None | Development/testing only (never in production) | RFC 7519 |
| Claim | Name | Type | Description | Required? | Validation |
|---|---|---|---|---|---|
| iss | Issuer | String/URI | Identifies who issued the JWT | Optional | Verify it matches the expected issuer |
| sub | Subject | String/URI | Identifies the JWT subject (user ID, email) | Optional | Use for authorization |
| aud | Audience | String/URI or array | Identifies the JWT recipients | Optional | Verify your service is in the audience |
| exp | Expiration | NumericDate (seconds since epoch) | Time after which the JWT MUST NOT be accepted | Recommended | Reject if current time > exp |
| nbf | Not Before | NumericDate | Time before which the JWT MUST NOT be accepted | Optional | Reject if current time < nbf |
| iat | Issued At | NumericDate | Time when the JWT was issued | Recommended | Optional: reject if older than tolerance |
| jti | JWT ID | String | Unique JWT identifier (prevents replay attacks) | Optional | Verify against used token cache |
| Tool | Decoding | HS256 Signing | Privacy | Offline capable | Local processing | Secret exposure risk |
|---|---|---|---|---|---|---|
| Our tool (local) | 0.01s | 100% local | 0.03s | 100% local | ✅ No external data | ✅ Yes (works offline) | ✅ 100% frontend (Web Crypto API) | ❌ None (secret stays in browser memory) |
| jwt.io (online) | 0.05s + network | 0.05s + network | ❌ Code loads from server | ❌ No (requires internet) | ❌ Not verified | ⚠️ Secret could be logged |
| JWT Debugger (online) | 0.05s + network | 0.05s + network | ❌ Tokens sent to servers | ❌ No | ❌ Not verified | ⚠️ Tokens and secrets exposed |
| CLI tools (jq + openssl) | 0.01s | 0.02s | ✅ Local | ✅ Yes | ✅ 100% local | ❌ None (CLI handles locally) |
| Vulnerability | CWE ID | Description | Impact | Mitigation |
|---|---|---|---|---|
| alg=none attack | CWE-345 | Attacker changes alg to 'none' to bypass signature verification | Complete authentication bypass | Never accept 'none' algorithm in production; validate algorithm against whitelist |
| Key confusion (RS256 to HS256) | CWE-327 | Attacker switches from RS256 to HS256 and uses public key as symmetric secret | Token forgery | Always verify algorithm; never mix key types; use kid (key ID) for rotation |
| Weak HMAC secret (HS256) | CWE-326 | Using short or predictable secrets (e.g., 'secret', 'password123') | Token forgery via brute force | Use secrets with >64 bits of entropy (random, >32 characters) |
| No expiration (exp missing) | CWE-613 | Tokens never expire, can be reused indefinitely | Session hijacking | Always set exp claim with reasonable lifetime (15 min to 24 hours) |
| Information exposure | CWE-200 | Storing sensitive data in JWT payload | Data leakage | Never store passwords, credit cards, or PII in JWTs without encryption; use JWE for sensitive data |
🔐
Client authenticates → server issues JWT → client sends Authorization: Bearer <token> header on each request. Stateless, scalable to millions of requests. Used by Stripe, GitHub API, Spotify API, and thousands of microservices.
👥
Users authenticate once, receive a JWT, and access multiple applications without re-authenticating. OpenID Connect (OIDC) builds on JWT for the identity layer. Used by Google, Microsoft Azure AD, Okta, Auth0.
🔄
Internal service A issues JWT → service B validates signature with public key → no central database needed. Ideal for zero-trust architectures. Used by Kubernetes, Docker, and service meshes (Istio, Linkerd).
📱
Native iOS/Android apps authenticate against backend → JWT stored securely (Keychain/Keystore) → included in each API call. Offline validation possible if public key is cached. Supports millions of concurrent users.
JWT (JSON Web Token) is the container format. JWS (JSON Web Signature) is a signed JWT — the most common type (HMAC/RSA/ECDSA). JWE (JSON Web Encryption) is an encrypted JWT, where the payload is encrypted for confidentiality. Most APIs use JWS (signed, not encrypted). Our tool handles JWS (signed tokens).
JWTs are stateless, so there's no built-in revocation mechanism. Common approaches: (1) Maintain a denylist of revoked token IDs (jti claim) in a fast cache (Redis). (2) Use short expiration times (5-15 min) plus refresh tokens. (3) Change the user's password or rotate signing keys. For high-security applications, keep a session database, negating the stateless advantage.
Recommended: secure httpOnly cookies (prevents XSS, but vulnerable to CSRF — use SameSite=Strict). Not recommended: localStorage (vulnerable to XSS; any script can read tokens). For SPAs without server-side rendering, use memory (React/Vuex state) with silent renewal. Our tool is for debugging/development, not for production token management.
Yes, but with caveats. JWT size grows with claims (might exceed browser's 4KB cookie limit). Refresh token rotation is complex. Many recommend traditional session cookies for browser applications and JWTs for API-to-API communication. Evaluate your threat model: JWTs excel in distributed/stateless systems, sessions are simpler for monolithic applications without mobile clients.
Ideally less than 1KB (fits in HTTP headers without fragmentation). Each claim adds size. A typical JWT with 5-8 claims occupies 200-400 bytes. Large JWTs (>8KB) cause issues with HTTP header size limits (8KB on many servers). If you need more data, consider reference tokens (store data on server, pass an opaque identifier).
Yes, if the secret is strong (≥256 bits, randomly generated, stored in a secret manager) and the internal network is trusted. HS256 is faster than RSA/ECDSA and simpler. For zero-trust environments or external clients, use RS256/ES256 so the private key never leaves the authentication server. Never hardcode secrets in source code.
✅
✅ Single authentication server ✅ Trusted internal network ✅ Need maximum performance (low latency) ✅ Simple key management (shared secret) ✅ No third-party token validation
✅
✅ Multiple microservices validate tokens ✅ External clients need public key ✅ Zero-trust architecture ✅ Need key rotation without downtime ✅ Compliance requires separate private key storage
❌
❌ NEVER in production ❌ Local testing only ❌ Disable it in your JWT library ❌ CVE-2015-9235 (alg=none vulnerability)
JWT is a powerful tool for modern authentication, but with great power comes great responsibility. The most common vulnerabilities aren't in the JWT specification — they're in flawed implementations: weak secrets, algorithm confusion attacks, missing expiration validation, and trusting tokens before verifying the signature. Test, audit, validate. Security is a process, not a product.
— Based on: RFC 7519 (JWT), RFC 7518 (JWA), NIST SP 800-57 (Key Management), OWASP JWT Cheatsheet (2025), CWE Top 25 (2025)Completely free
No registration
No external servers
Your security is our priority
100% local processing
Comments
Log in to leave a comment
🔒 100% local processing · no token leaves your browser