JWT Decoder: Debug Authentication Tokens Safely
Last updated: 2026-03-08
Target keyword: jwt decoder online
---
Introduction
Working with JWTs (JSON Web Tokens) for authentication? Need to inspect token contents without sending them to a server? A JWT decoder lets you safely decode and inspect tokens right in your browser.
In this guide, we'll explain what JWTs are, how they work, why decoding matters, security best practices, and the best free online tools for JWT decoding.
---
What is a JWT?
JWT (pronounced "jot") stands for JSON Web Token. It's a compact, URL-safe means of representing claims to be transferred between two parties.
JWT Structure
A JWT consists of three parts separated by dots:
header.payload.signatureExample JWT:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cThe Three Parts
1. Header - Algorithm and token type
{
"alg": "HS256",
"typ": "JWT"
}2. Payload - Claims (user data + metadata)
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022,
"exp": 1516242622
}3. Signature - Verifies authenticity
HMACSHA256(
base64UrlEncode(header) + "." + base64UrlEncode(payload),
secret
)---
Why Decode JWTs?
1. Debug Authentication Issues
When login fails or tokens expire unexpectedly, decoding helps identify the problem.
2. Inspect User Claims
View what data is stored in the token without making API calls.
3. Verify Token Expiration
Check exp (expiration time) and iat (issued at) claims.
4. Validate Token Structure
Ensure your auth library is generating tokens correctly.
5. Security Audits
Review what information is being exposed in tokens.
---
JWT Use Cases
Authentication
// User logs in
POST /login { email, password }// Server returns JWT
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
// Client includes in subsequent requests
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Information Exchange
JWTs can securely transmit information between parties—common in SSO (Single Sign-On) scenarios.
Session Management
Store session data in JWT instead of server-side sessions for stateless authentication.
---
Common JWT Claims
| Claim | Name | Description |
|-------|------|-------------|
| iss | Issuer | Who issued the token |
| sub | Subject | User/entity identifier |
| aud | Audience | Intended recipient |
| exp | Expiration | Token expiry time |
| iat | Issued At | Token creation time |
| nbf | Not Before | Token valid from |
| jti | JWT ID | Unique token identifier |
| name | - | User's full name |
| email | - | User's email address |
| roles | - | User roles/permissions |
---
How to Decode JWTs
Manual Decoding (Base64)
JWT header and payload are Base64Url encoded:
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U";const [header, payload, signature] = token.split('.');
// Decode header
const decodedHeader = JSON.parse(atob(header.replace(/-/g, '+').replace(/_/g, '/')));
// Decode payload
const decodedPayload = JSON.parse(atob(payload.replace(/-/g, '+').replace(/_/g, '/')));
Using DevKits JWT Decoder
1. Navigate to Tool - Visit JWT Decoder 2. Paste Token - Copy your JWT 3. Auto Decode - Tool parses all three parts 4. View Details - See decoded header, payload, and signature info 5. Verify Expiration - Check if token is expired
---
JWT Security Best Practices
✅ Do
- Use HTTPS to transmit JWTs
- Set reasonable expiration times
- Store JWTs securely (httpOnly cookies or secure storage)
- Validate signature on server-side
- Use strong signing algorithms (RS256, ES256)
- Include
expclaim in all tokens
❌ Don't
- Store sensitive data (passwords, credit cards) in JWT payload
- Trust tokens without verifying signature
- Use weak algorithms (none, HS256 with weak secret)
- Set excessively long expiration times
- Log JWTs (they may contain sensitive data)
JWT Algorithm Types
HS256 (HMAC with SHA-256)
Symmetric algorithm—same secret for signing and verifying.
{
"alg": "HS256",
"typ": "JWT"
}Use case: Single service authentication
RS256 (RSA Signature with SHA-256)
Asymmetric algorithm—private key signs, public key verifies.
{
"alg": "RS256",
"typ": "JWT"
}Use case: Microservices, OAuth providers
ES256 (ECDSA with SHA-256)
Elliptic curve cryptography—shorter signatures, same security.
{
"alg": "ES256",
"typ": "JWT"
}Use case: Mobile apps, IoT devices
⚠️ None Algorithm
{
"alg": "none",
"typ": "JWT"
}Never accept tokens with "none" algorithm in production!
---
JWT in Different Languages
Node.js (jsonwebtoken)
const jwt = require('jsonwebtoken');// Sign
const token = jwt.sign(
{ userId: 123, email: '[email protected]' },
'your-secret-key',
{ expiresIn: '1h' }
);
// Verify
const decoded = jwt.verify(token, 'your-secret-key');
Python (PyJWT)
import jwtSign
token = jwt.encode(
{'userId': 123, 'email': '[email protected]'},
'your-secret-key',
algorithm='HS256'
)Verify
decoded = jwt.decode(token, 'your-secret-key', algorithms=['HS256'])PHP (firebase/php-jwt)
use Firebase\JWT\JWT;// Sign
$token = JWT::encode(
['userId' => 123, 'email' => '[email protected]'],
'your-secret-key',
'HS256'
);
// Verify
$decoded = JWT::decode($token, new Key('your-secret-key', 'HS256'));
---
Try DevKits JWT Decoder
Need to inspect JWT tokens? Try our free JWT Decoder:
- ✅ Decode header, payload, and signature
- ✅ Display expiration and issued-at times
- ✅ Highlight expired tokens
- ✅ 100% client-side (tokens never leave browser)
- ✅ No server verification (safe for debugging)
- ✅ No signup required
Frequently Asked Questions
Q: Can I modify a JWT after decoding?
A: You can decode and view the payload, but modifying it will invalidate the signature. The server will reject tampered tokens.
Q: Is JWT decoding safe?
A: Yes, decoding only reads the Base64-encoded payload—it doesn't require the secret key. However, never share your tokens publicly.
Q: What's the difference between decoding and verifying?
A: Decoding just reads the Base64 content. Verifying checks the signature using the secret/key to confirm authenticity.
Q: Can JWTs be revoked?
A: Not inherently—they're stateless. Implement a blocklist or use short expiration times with refresh tokens for revocation.
Q: How long should JWTs be valid?
A: Typically 15 minutes to 24 hours, depending on security requirements. Use refresh tokens for longer sessions.
---
Conclusion
A JWT decoder is an essential tool for developers working with token-based authentication. It helps debug issues, inspect claims, and understand token structure—all without sending sensitive data to a server.
Key takeaways:
- JWTs have three parts: header, payload, signature
- Decoding is safe and doesn't require secrets
- Never store sensitive data in JWT payload
- Always verify signatures on the server-side
- Use short expiration times for security
---
Related Tools: