JWT Decoder & Security Studio

Advanced JWT debugger — decode, verify & build tokens. Supports HS256/384/512, RS256/384/512 & ES256/384/512. 12-point security audit. 100% offline.

Security Studio WebCrypto API Active
Edit JSON directly — token updates in real-time. Requires secret to re-sign.
Header
ALGORITHM & TYPE
Payload
CLAIMS & DATA
Signature
HMAC-SHA256
Paste a JWT token to inspect its claims
SECURE
Decode a token to run the audit
Preset Templates
Click a preset to load a ready-to-use JWT structure into the editor. Then add your secret in the sidebar to generate a signed token.
Add Claim to Payload
Values are parsed as JSON — wrap strings in quotes. e.g. "admin", true, 3600
Recent Tokens (stored locally, never uploaded)
Export Token

1JWT Structure — Header.Payload.Signature

A JSON Web Token is a compact, URL-safe string composed of exactly three Base64Url-encoded parts separated by dots: HEADER.PAYLOAD.SIGNATURE. Each part encodes specific data and plays a distinct role in the security architecture.

ComponentFunction & Security Rule
HeaderSpecifies the signing algorithm (alg) and token type (typ). Decoded by anyone. Never encrypt secrets here.
PayloadContains the claims — user data, permissions, expiry times. Visible to everyone. Base64Url encoded, not encrypted.
SignatureCryptographic proof that the header and payload were not tampered with. Requires the secret key to generate or verify.

The signature is computed as ALG(base64url(header) + "." + base64url(payload), secret). If anyone modifies even a single character in the header or payload, the signature instantly becomes invalid — without the secret key, tampering is detectable.

2The Base64 Misconception — Encoded ≠ Encrypted

The most dangerous JWT security misconception is that tokens hide payload data. They do not. Anyone who intercepts or receives the token string can instantly decode the payload using nothing more than a Base64 decoder.

Never store sensitive data in JWT payloads. Passwords, Social Security Numbers, credit card numbers, private keys, and API secrets are plaintext-readable by any token holder. If you need payload privacy, use JWE (JSON Web Encryption) — a separate standard that encrypts the payload with AES-GCM.

What Base64Url encoding provides: a URL-safe, compact, text-friendly transport format for the JSON structures. It is reversible transformation, not protection. The only security guarantee in a standard JWT is the signature — proving the token was issued by someone who knows the secret, and that it was not modified in transit.

3Algorithm Guide — HMAC, RSA & ECDSA

HS256 / HS384 / HS512 — HMAC (Symmetric)

HMAC algorithms use a single shared secret key for both creating and verifying tokens. Extremely fast. Simple to implement. Fatal flaw: every microservice that needs to verify tokens must possess the secret — and any service that can verify can also forge tokens. Best for single-server or trusted monolithic environments.

RS256 / RS384 / RS512 — RSA (Asymmetric)

RSA uses a key pair: a private key held only by the auth server to sign tokens, and a public key distributed to all verifying services. Services can verify tokens without being able to forge them. The gold standard for OAuth2/OIDC systems (Auth0, Okta, Google). Disadvantage: larger tokens and slower signing compared to HMAC.

RS256 is recommended for production APIs serving multiple microservices. Publish your public key at a /.well-known/jwks.json endpoint and rotate it regularly without touching your services.

ES256 / ES384 / ES512 — ECDSA (Asymmetric)

ECDSA provides the same asymmetric guarantees as RSA but with much smaller keys and signatures. ES256 uses the P-256 elliptic curve — its 32-byte signature is 8× smaller than an equivalent RS256 signature. Ideal for environments where token size matters (mobile apps, IoT, CDN edge functions). ES256 is now preferred over RS256 in modern auth systems.

4Standard Claims — RFC 7519 Reference

JWT payloads use compact 3-letter claim names from RFC 7519 to minimise token size. The Claims Inspector tab fully parses all of these automatically:

ClaimNameUsage & Security Rules
issIssuerWho created and signed the token. Case-sensitive URI, e.g., https://auth.example.com.
subSubjectThe principal the token represents (usually user ID). Unique within the issuer context.
audAudienceIntended recipient(s). Must match the verifying application's identifier exactly.
expExpirationUnix timestamp after which the token must be rejected. Always set this.
nbfNot BeforeToken must not be accepted before this Unix timestamp. Guards against clock-skew abuse.
iatIssued AtUnix timestamp of token creation. Used to calculate token age and enforce maximum lifetimes.
jtiJWT IDUnique identifier for this specific token. Enables replay attack prevention via server-side blocklist.

5Common JWT Attacks

1. Algorithm Confusion (alg:none)

An attacker crafts a token with "alg":"none" and removes the signature. Vulnerable backends that blindly trust the algorithm field will accept the unsigned, forged token. Fix: Always whitelist allowed algorithms server-side. Never trust the alg header value without validation.

2. Algorithm Substitution (RS256 → HS256)

If a server supports both RS256 and HS256, an attacker may forge an HS256 token signed with the public RSA key (which is publicly known). The server mistakenly verifies it using the public key as an HMAC secret. Fix: Pin the expected algorithm in your verification code. Do not accept multiple algorithms for the same endpoint.

3. Weak Secret Brute Force

Short or common HMAC secrets can be brute-forced offline. An attacker who captures a valid token can attempt millions of secret candidates per second. Fix: Use cryptographically random secrets of at least 256 bits (32 bytes) for HS256, 384 bits for HS384, 512 bits for HS512. Never use dictionary words or passwords.

4. JWT Replay After Expiry

Without a server-side blocklist and a jti claim, stolen valid tokens can be replayed even after the user logs out. Fix: Implement token revocation — maintain a Redis-backed blocklist of invalidated jti values, or use short token lifetimes (≤15 minutes) with refresh token rotation.

Pro tip: Run every token through the Security Audit tab above. The 12-point vulnerability scanner checks for all known JWT security weaknesses automatically.

6JWS vs. JWE — When to use Encryption

The standard JWT you are familiar with is technically a JWS (JSON Web Signature). It guarantees data integrity but provides absolutely zero privacy. Anyone can decode it. If you must transmit highly sensitive Personally Identifiable Information (PII) or secrets through an untrusted medium, you must use a JWE (JSON Web Encryption).

FormatPrimary PurposeStructureUse Case
JWSAuthentication & IntegrityHeader.Payload.SignatureStandard stateless user sessions (OAuth2 / OIDC).
JWEConfidentiality & PrivacyHeader.EncKey.Iv.Ciphertext.TagTransmitting sensitive health data or API secrets.

7JWT Best Practices Checklist

  • Always set exp — access tokens ≤15 min, API keys ≤24h, refresh tokens ≤30 days with rotation
  • Include jti — unique UUID per token, maintain revocation blocklist
  • Set aud — explicitly name the target API to prevent token reuse across services
  • Use RS256 or ES256 for distributed systems — HMAC is only safe in single-trust-boundary systems
  • Use HTTPS only — a JWT in transit over HTTP is completely exposed to network sniffers
  • Store tokens securely — HttpOnly cookies preferred over localStorage (immune to XSS exfiltration)
  • Never put secrets in the payload — payload is publicly readable by any token holder
  • Validate all claims — verify iss, aud, exp, nbf on every request
  • Whitelist algorithms — hardcode the expected algorithm; never trust the header's alg field alone
  • Rotate secrets regularly — for HMAC, rotate at least every 90 days; for RSA/EC, rotate annually

8Token Size Limits & Performance Impact

Because JWTs are stateless, they must carry all necessary authorization data (like user roles and permissions) on every single HTTP request. This creates a critical tradeoff between statefulness and network bandwidth.

The 8KB Proxy Threshold

While the JWT specification (RFC 7519) does not define a maximum size limit, the physical infrastructure of the internet does. Most load balancers, proxies (like Nginx, HAProxy), and CDNs (Cloudflare, AWS CloudFront) enforce strict limits on HTTP header sizes — typically around 8KB (8,192 bytes). If your Authorization: Bearer <token> header exceeds this limit, the proxy will reject the request with a 431 Request Header Fields Too Large error before it ever reaches your application.

Information Gain: To prevent token bloat, never store full user profiles, UI preferences, or massive role arrays in the payload. Instead, store a lightweight role_id or session_id and fetch the heavy metadata server-side using a high-speed cache like Redis.

9Implementing Refresh Token Rotation Safely

To mitigate the risk of stolen access tokens, modern auth architectures rely on Refresh Token Rotation (RTR). Instead of issuing a single long-lived refresh token, RTR issues a new refresh token every time the client requests a new access token.

How RTR Prevents Token Theft

When a client uses a refresh token (Token A) to get a new access token, the server invalidates Token A and issues Token B. If an attacker stole Token A and tries to use it after the legitimate client already used it, the server detects the reuse of an invalidated token. The server immediately assumes a breach has occurred and revokes the entire token family, forcing the legitimate user to re-authenticate and locking the attacker out.

Storage MechanismSecurity StatusVulnerability
localStorageHigh RiskVulnerable to Cross-Site Scripting (XSS) attacks. Any malicious script on the page can steal the tokens.
sessionStorageModerate RiskStill vulnerable to XSS, but tokens are cleared when the browser tab is closed.
HttpOnly CookiesMost SecureImmune to XSS. JavaScript cannot read the token. Must be combined with SameSite=Strict to prevent CSRF.

10Debugging "Invalid Signature" Errors

When your backend server rejects a JWT with an "Invalid Signature" or "Signature Verification Failed" error, it can be notoriously difficult to debug because cryptography provides zero feedback on why the math failed. Here is the definitive diagnostic checklist:

  • Mismatched Secrets: Ensure your verifying server is using the exact same HMAC secret string or RSA public key that the issuing server used. A single character difference causes total failure.
  • Encoding Mismatches: Is your secret Base64 encoded in your environment variables, but your code is reading it as a raw string? Ensure both the issuer and verifier handle the secret's encoding format identically (e.g., parsing a Hex or Base64 string into a byte array before hashing).
  • Trailing Whitespace: A common issue when loading PEM public keys from .env files. Trailing spaces or missing newline characters in the PEM header/footer (-----BEGIN PUBLIC KEY-----) will corrupt the key buffer.
  • Algorithm Mismatch: The server expects RS256 but the token header says HS256. (This studio's 12-Point Audit flags this as a Key Confusion vulnerability).

FAQFrequently Asked Questions

What is a JSON Web Token (JWT) and how is it structured?
A JSON Web Token (RFC 7519) is a compact, URL-safe standard for securely transmitting claims between parties. A JWT consists of three Base64URL-encoded strings separated by dots (.):
  • Header: Specifies token type (typ: "JWT") and cryptographic signing algorithm (e.g., alg: "HS256").
  • Payload: Contains claims (statements about an entity, such as user ID, roles, and expiration time).
  • Signature: Cryptographic hash generated by signing the header and payload with a private key or secret.
Is it safe to paste production or confidential JWTs into this tool?
Yes, 100% safe. This studio executes entirely on the client side inside your browser using native JavaScript and the Web Cryptography API. Zero network requests are made, and your token strings, secrets, and payload claims are never transmitted to any server or external database.
What is the difference between decoding a JWT and verifying a JWT?
Decoding a JWT simply Base64URL-decodes the header and payload into readable JSON. Anyone can decode a JWT without a password or key. Verifying a JWT uses the secret key or public certificate to cryptographically recalculate the signature and verify that the payload has not been tampered with in transit.
Which cryptographic signing algorithms can this studio verify?
The studio supports all standard JWA (RFC 7518) algorithms:
  • HMAC Symmetric: HS256 (HMAC-SHA256), HS384, HS512 using shared secrets.
  • RSA Asymmetric: RS256 (RSASSA-PKCS1-v1_5), RS384, RS512, PS256, PS384, PS512 using PEM Public Keys or X.509 Certificates.
  • ECDSA Elliptic Curve: ES256 (P-256 curve), ES384 (P-384), ES512 (P-521).
What are the standard registered JWT claims (iss, sub, aud, exp, nbf, iat, jti)?
RFC 7519 defines standard reserved claim keys:
  • iss (Issuer): The identity provider or authority that issued the token.
  • sub (Subject): The unique identifier of the user or principal.
  • aud (Audience): The intended recipient service or API.
  • exp (Expiration Time): UNIX epoch timestamp after which the token is invalid.
  • nbf (Not Before): UNIX epoch timestamp before which the token must be rejected.
  • iat (Issued At): UNIX epoch timestamp when the token was minted.
  • jti (JWT ID): Unique identifier for preventing replay attacks.
How does the 12-Point Automated Security Audit work?
The studio automatically inspects your JWT for critical security misconfigurations:
  • None Algorithm Detection: Flags tokens with "alg": "none" vulnerability.
  • Key Confusion Vulnerability: Checks for HMAC-RSA algorithm confusion attacks.
  • Weak Secret Entropy: Detects common default secrets like "secret", "password", "123456".
  • Expired / Premature Token: Evaluates exp and nbf against current local system time.
  • Missing Critical Claims: Alerts if exp, iss, or sub are absent.
  • PII Exposure: Warns if unencrypted passwords or credit card numbers appear in plain text payload claims.
What is the "None" Algorithm vulnerability (alg: "none")?
In early JWT specifications, the "none" algorithm was allowed for unsigned tokens. Malicious actors exploited vulnerable backends by modifying payload data (e.g. changing role: "user" to role: "admin"), setting "alg": "none" in the header, and stripping the signature. Secure systems must strictly reject any token signed with "none".
What is the HMAC vs RSA Key Confusion attack?
This attack occurs when a backend server designed for asymmetric RSA (RS256) mistakenly accepts symmetric HMAC (HS256). An attacker takes the server's publicly available RSA public key file and uses it as the secret key to sign a forged JWT with HS256. The server then verifies the token using the public key as an HMAC secret, granting unauthorized access.
What is the difference between Access Tokens and Refresh Tokens?
Access Tokens are short-lived credentials (typically valid for 5 to 15 minutes) passed in the HTTP Authorization: Bearer <token> header to access protected APIs. Refresh Tokens are long-lived tokens (valid for days to months) stored securely in httpOnly, SameSite=Strict cookies to request new access tokens when they expire, without requiring user re-authentication.
Can sensitive information (passwords, SSNs) be stored in a JWT payload?
No, never. Standard JWTs (JWS) are digitally signed, not encrypted. The payload is merely Base64URL-encoded, meaning anyone with network access or browser dev tools can decode and read all payload claims in plain text. To store sensitive confidential data, use JSON Web Encryption (JWE).
What is a JWKS (JSON Web Key Set) and how does the kid header work?
A JWKS is a JSON object containing a set of public keys exposed by identity providers (like Auth0, Okta, Firebase, AWS Cognito) at /.well-known/jwks.json. The JWT header contains a kid (Key ID) claim that informs the verifying server which public key in the JWKS to use for signature validation during key rotation.
How can stateless JWTs be revoked or invalidated before expiration?
Because standard JWTs are stateless and verified without database lookups, immediate revocation requires:
  • Token Blacklisting: Storing revoked jti IDs in a fast in-memory store (Redis) with TTL matching token expiration.
  • User Token Versioning: Storing a token_version integer on the user record and embedding it in the JWT; incrementing the version invalidates all older tokens.
  • Short Lifespans: Keeping access token validity under 5-10 minutes so compromised tokens expire rapidly.
How do I generate RS256 RSA Public and Private Keys for JWT signing?
You can generate a standard 2048-bit RSA key pair using OpenSSL: openssl genrsa -out private.pem 2048 (generate private key) and openssl rsa -in private.pem -pubout -out public.pem (extract public key). The private key signs the token on your auth server, and the public key verifies it in this studio.
Why does my JWT say "Token Expired" or "Token Not Active Yet"?
JWTs validate time against UNIX epoch seconds:
  • Token Expired: The current UNIX timestamp exceeds the value in the exp claim.
  • Token Not Active Yet: The current timestamp is earlier than the nbf (Not Before) or iat (Issued At) claim, often caused by clock drift between your client machine and the issuing server.
Can I use this studio to decode OpenID Connect (OIDC) ID Tokens?
Yes. OpenID Connect ID Tokens are standard JWTs containing identity claims (e.g. email, email_verified, name, picture, nonce). You can paste tokens from Google Sign-In, Apple ID, Microsoft Entra, or GitHub OAuth directly into the inspector.

Rate JWT Decoder, Verifier & Security Inspector

Help us improve by rating this tool.

4.7/5
638 reviews