JSON Web Tokens (JWTs) are the backbone of modern authentication — from API authorization to single sign-on. But when something goes wrong, you need to quickly decode and inspect the token to find the problem. This guide explains how JWTs work, what each part contains, and how to use our free JWT decoder to debug tokens instantly without exposing them to third-party servers.
Decode JWT Tokens — Free & Private
Paste any JWT and instantly see the decoded header, payload claims, expiry status, and algorithm. No signup, no server — runs entirely in your browser.
What Is a JSON Web Token (JWT)?
A JSON Web Token (JWT, pronounced "jot") is a compact, URL-safe string used to securely transmit information between two parties. It's defined by RFC 7519 and is widely used for authentication and authorization in web applications and APIs.
Why JWTs Are Popular
- Stateless: The server doesn't need to store session data — the token itself contains all necessary information.
- Compact: Small enough to be sent in HTTP headers, URL parameters, or cookies.
- Self-contained: The payload carries user identity and permissions, reducing database lookups.
- Cross-domain: Works seamlessly across different domains and microservices.
JWTs are used by major platforms like Google, Auth0, Firebase, AWS Cognito, and virtually every modern API that uses OAuth 2.0 or OpenID Connect.
JWT Structure: Header, Payload, and Signature
Every JWT consists of three parts separated by dots (.):
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0In0.signature
Each part is Base64URL-encoded JSON:
1. Header
The header typically contains two fields:
- alg: The signing algorithm (e.g., HS256, RS256, ES256)
- typ: The token type, usually "JWT"
{
"alg": "HS256",
"typ": "JWT"
}
2. Payload (Claims)
The payload contains claims — statements about the user and metadata. There are three types:
| Type | Examples | Description |
|---|---|---|
| Registered | iss, sub, exp, iat, aud | Predefined by the JWT standard |
| Public | name, email, role | Custom but commonly used |
| Private | company_id, plan | Custom claims for your app |
{
"sub": "user_1234",
"name": "Jane Doe",
"role": "admin",
"iat": 1711670400,
"exp": 1711756800
}
3. Signature
The signature is created by signing the encoded header and payload with a secret key (HMAC) or private key (RSA/ECDSA). It ensures the token hasn't been tampered with. Verification requires the secret or public key — which is why browser decoders can read but not verify tokens.
Common JWT Claims Explained
Understanding standard claims is essential for debugging authentication issues:
| Claim | Full Name | Description | Example |
|---|---|---|---|
| iss | Issuer | Who created and signed the token | "https://auth.example.com" |
| sub | Subject | The user or entity the token represents | "user_1234" |
| aud | Audience | Intended recipient (API or service) | "https://api.example.com" |
| exp | Expiration | Unix timestamp when the token expires | 1711756800 |
| iat | Issued At | Unix timestamp when the token was created | 1711670400 |
| nbf | Not Before | Token is invalid before this time | 1711670400 |
| jti | JWT ID | Unique identifier to prevent replay attacks | "abc-123-def" |
If your API returns 401 Unauthorized, the first thing to check is the exp claim — expired tokens are the #1 cause of auth failures.
JWT Signing Algorithms: HS256 vs RS256 vs ES256
The algorithm in the JWT header determines how the signature is created and verified:
| Algorithm | Type | Key | Best For |
|---|---|---|---|
| HS256 | HMAC + SHA-256 | Shared secret | Simple apps, same-server auth |
| HS384 / HS512 | HMAC + SHA-384/512 | Shared secret | Higher security HMAC |
| RS256 | RSA + SHA-256 | Public/private key pair | Microservices, third-party verification |
| ES256 | ECDSA + SHA-256 | Public/private key pair | Mobile apps, performance-sensitive |
| PS256 | RSA-PSS + SHA-256 | Public/private key pair | Enhanced RSA security |
Which Should You Use?
- HS256: Simplest option when both the issuer and verifier share the same secret (e.g., a single backend server).
- RS256: The most common choice for distributed systems — the private key signs tokens, and any service with the public key can verify them. Used by Auth0, Google, and AWS Cognito.
- ES256: Smaller signatures and faster verification than RSA — ideal for mobile and IoT applications.
How to Decode a JWT Token Online
Our free JWT decoder lets you inspect any token instantly without sending it to a server:
Step-by-Step
- Copy your JWT — from your browser's DevTools (Application → Cookies or Network → Headers), API response, or terminal.
- Paste into the decoder — the tool instantly splits the token into its three parts.
- Inspect the header — check the algorithm (
alg) and token type. - Review the payload — see all claims including user info, roles, and timestamps.
- Check expiry status — the tool compares
expto your current time and shows a green "Valid" or red "Expired" badge.
Our decoder runs 100% in your browser using JavaScript. Your JWT token never leaves your device — no data is sent to any server. This is critical because JWTs often contain sensitive user information.
Debugging Common JWT Issues
When authentication breaks, JWTs are often the culprit. Here are the most common issues and how to diagnose them:
1. Token Expired (401 Unauthorized)
Decode the token and check the exp claim. If it's in the past, the token has expired. Solution: refresh the token using your refresh token endpoint, or request a new one.
2. Invalid Audience (403 Forbidden)
The aud claim doesn't match what the API expects. This happens when you use a token meant for one API with a different one. Check your OAuth configuration.
3. Token Not Yet Valid
If the nbf (Not Before) claim is set to a future time, the token won't be accepted yet. This can happen due to clock skew between servers.
4. Missing Required Claims
Some APIs require specific claims like role, scope, or permissions. Decode the token to verify these claims exist and have the expected values.
5. Algorithm Mismatch
The server expects RS256 but the token uses HS256 (or vice versa). This is also a known security vulnerability — always validate the algorithm server-side.
6. Clock Skew
If iat (issued at) is slightly in the future relative to the verifying server, it may reject the token. Most libraries allow a small leeway (typically 30–60 seconds).
JWT Security Best Practices
JWTs are powerful but can be dangerous if misused. Follow these best practices:
- Keep tokens short-lived: Set
expto 15–60 minutes for access tokens. Use refresh tokens for longer sessions. - Never store secrets in the payload: JWTs are encoded, not encrypted — anyone can decode and read the payload. Never put passwords, API keys, or sensitive data in claims.
- Always validate the algorithm: Explicitly set the expected algorithm server-side to prevent "alg: none" attacks.
- Use HTTPS only: Transmit tokens only over HTTPS to prevent man-in-the-middle interception.
- Store tokens securely: Use HttpOnly cookies (not localStorage) to prevent XSS attacks from stealing tokens.
- Validate all claims: Always verify
iss,aud,exp, andnbfserver-side — not just the signature. - Rotate signing keys: Periodically rotate your signing keys and use the
kid(Key ID) header to manage multiple keys. - Implement token revocation: Since JWTs are stateless, consider a token blocklist or short expiry + refresh token pattern for revocation.
Never decode JWTs containing production credentials on third-party websites. Use a privacy-first tool like ours that processes everything locally in your browser.
JWT vs Session Tokens vs API Keys
Choosing the right authentication mechanism depends on your use case:
| Feature | JWT | Session Token | API Key |
|---|---|---|---|
| Stateless | Yes — self-contained | No — requires server-side store | No — requires server lookup |
| Expiry | Built-in (exp claim) | Server-managed | Usually never expires |
| Revocation | Difficult (needs blocklist) | Easy (delete from store) | Easy (delete key) |
| Payload data | Yes (claims) | No (just an ID) | No (just a key) |
| Cross-domain | Easy (Bearer header) | Hard (cookie domain limits) | Easy (header) |
| Best for | SPAs, microservices, OAuth | Traditional web apps | Server-to-server, third-party |
Many modern applications use a combination: JWTs for short-lived access tokens, refresh tokens stored as HttpOnly cookies, and API keys for external integrations.
How to Use the Tool (Step by Step)
- 1
Copy Your JWT Token
Get the token from your browser DevTools (Cookies or Network tab), API response, or terminal output.
- 2
Paste into the Decoder
Open the JWT Decoder tool and paste your token. It is instantly split into header, payload, and signature.
- 3
Inspect Header & Algorithm
Check the signing algorithm (HS256, RS256, etc.) and token type in the decoded header.
- 4
Review Payload Claims
Examine all claims — user ID, roles, permissions, issued time, and expiration.
- 5
Check Token Validity
The tool automatically compares the expiry time to your current time and shows whether the token is still valid or expired.
Frequently Asked Questions
Can this tool verify the JWT signature?+−
No. Signature verification requires the secret key or public key, which should never be pasted into a browser tool. Our decoder only reads the Base64-encoded header and payload — it does not validate the cryptographic signature.
Is my JWT token sent to a server?+−
No. All decoding happens 100% in your browser using JavaScript. Your token never leaves your device. This is important because JWTs often contain user identity and permissions data.
What does it mean if my JWT is expired?+−
An expired JWT means the current time has passed the Unix timestamp in the "exp" claim. The token will be rejected by any properly configured server. You need to obtain a new token, usually via a refresh token endpoint.
Can I decode a JWT without the secret key?+−
Yes. The header and payload of a JWT are only Base64URL-encoded, not encrypted. Anyone can decode and read them. The secret key is only needed to verify the signature — not to read the contents.
What is the difference between HS256 and RS256?+−
HS256 uses a shared secret key for both signing and verification (symmetric). RS256 uses a private key to sign and a public key to verify (asymmetric). RS256 is preferred for distributed systems where multiple services need to verify tokens.
Why should I not store JWTs in localStorage?+−
localStorage is accessible to any JavaScript running on the page, making tokens vulnerable to XSS (cross-site scripting) attacks. HttpOnly cookies are safer because JavaScript cannot access them.
Decode JWT Tokens — Free & Private
Paste any JWT and instantly see the decoded header, payload claims, expiry status, and algorithm. No signup, no server — runs entirely in your browser.
Open JWT Decoder →Related Guides
Hash Generator — MD5, SHA-256, SHA-1 and More Explained (2026)
Generate MD5, SHA-1, SHA-256, SHA-512 hashes online — understand hashing, verify file integrity, secure data.
Base64 Encode & Decode — What It Is, How It Works & When to Use It
Developer guide to Base64 encoding: use cases, online decoder, and common pitfalls
Password Strength Checker — What Makes a Password Secure in 2026
Understand password security: entropy, cracking time, and how to create unbreakable passwords
Regex Tester — Test Regular Expressions Online Free (2026)
Test and debug regex patterns with real-time matching, syntax highlighting, and cheat sheet. Free, browser-based.