-
Новости
- ИССЛЕДОВАТЬ
-
Страницы
-
Группы
-
Статьи пользователей
-
Форумы
JWT Decoder: The Complete Guide to Understanding JSON Web Tokens
authorize API requests, and share information between services securely. JSON Web Tokens, commonly called JWTs, have become the standard format for this job. But a JWT looks like a long scrambled string of characters at first glance, which makes debugging and inspection difficult without the right tool. Developers, security engineers, and API testers all benefit from having a toolkit like multiconverters.net that brings together essential utilities in one place, making it easy to decode, inspect, and understand tokens without writing custom scripts.
What Is a JWT?
A JSON Web Token (JWT) is a compact, URL-safe token format used to represent claims between two parties. A claim is a statement about a subject, such as a user's identity, role, permissions, or session expiry time. JWTs are widely used in authentication systems, single sign-on (SSO), and API authorization.
A JWT is not encrypted by default. It is encoded using Base64URL, which means anyone who has the token can decode it and read its contents. The security of a JWT comes from its signature, which proves the token was issued by a trusted party and has not been tampered with.
The Structure of a JWT
Every JWT consists of three parts separated by dots:
header.payload.signature
A real JWT looks like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Each section is Base64URL encoded. A JWT Decoder splits the token at the dots and decodes each section separately.
Part 1: Header
The header contains metadata about the token itself, specifically the algorithm used to sign it and the token type.
{
"alg": "HS256",
"typ": "JWT"
}
| Field | Meaning |
|---|---|
| alg | Signing algorithm (HS256, RS256, ES256, etc.) |
| typ | Token type, always JWT |
| kid | Key ID, used to select the correct verification key |
Part 2: Payload
The payload contains the claims. These are the actual data the token carries.
{
"sub": "1234567890",
"name": "John Doe",
"email": "john@example.com",
"role": "admin",
"iat": 1516239022,
"exp": 1516242622
}
Part 3: Signature
The signature is created by taking the encoded header and payload, joining them with a dot, and signing the result using the algorithm specified in the header and a secret key. The signature cannot be decoded like the header and payload. It can only be verified by recalculating it with the correct key and comparing.
Standard JWT Claims
JWT defines a set of standard claim names. Using these standard names ensures interoperability between different systems.
| Claim | Full Name | Description |
|---|---|---|
| iss | Issuer | Who issued the token (e.g. auth.example.com) |
| sub | Subject | Who the token is about (usually a user ID) |
| aud | Audience | Who the token is intended for |
| exp | Expiration Time | Unix timestamp when the token expires |
| nbf | Not Before | Token is not valid before this timestamp |
| iat | Issued At | Unix timestamp when the token was issued |
| jti | JWT ID | Unique identifier to prevent token reuse |
Custom claims can be added alongside these standard ones. For example, a role claim, a permissions array, or a tenant ID for multi-tenant applications.
How a JWT Decoder Works
A JWT Decoder takes a JWT string as input and performs the following steps:
- Splits the token into its three parts at the dot separators
- Base64URL-decodes the header and displays it as formatted JSON
- Base64URL-decodes the payload and displays it as formatted JSON
- Displays the signature section as a raw encoded string
- Optionally verifies the signature if a secret key or public key is provided
- Converts any Unix timestamps (exp, iat, nbf) into human-readable dates
The decoder shows you exactly what is inside the token without needing to write any code.
JWT Signing Algorithms
The algorithm used to sign a JWT determines how the signature is created and verified.
| Algorithm | Type | Key Type | Security Level | Common Use |
|---|---|---|---|---|
| HS256 | HMAC | Shared secret | Medium | Internal APIs |
| HS384 | HMAC | Shared secret | Medium | Internal APIs |
| HS512 | HMAC | Shared secret | High | Internal APIs |
| RS256 | RSA | Public/private key pair | High | Public APIs, SSO |
| RS384 | RSA | Public/private key pair | High | Public APIs |
| RS512 | RSA | Public/private key pair | Very High | Public APIs |
| ES256 | ECDSA | Public/private key pair | High | Mobile, IoT |
| none | None | No key | None (unsafe) | Never use in production |
HS256 uses a single shared secret known to both the issuer and the verifier. RS256 uses a private key to sign and a public key to verify, making it possible to share the verification key publicly without exposing the signing key.
Common JWT Use Cases
User Authentication
After a user logs in, the server issues a JWT containing the user's ID, roles, and expiry time. The client stores this token (usually in memory or an HTTP-only cookie) and sends it with every subsequent request. The server verifies the token without needing to look up a session in a database.
API Authorization
REST APIs use JWTs in the Authorization header to control access to protected endpoints:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
The API server decodes and verifies the token, then uses the claims to determine what the caller is allowed to do.
Single Sign-On (SSO)
In SSO systems, a central identity provider issues a JWT after authentication. Other services in the same organization accept that token without requiring the user to log in again. The JWT carries the user's identity and permissions across all services.
Information Exchange
JWTs can securely transmit information between two parties because the signature guarantees the content has not been altered in transit.
JWT vs Other Token Formats
| Feature | JWT | Opaque Token | SAML Token |
|---|---|---|---|
| Self-contained | Yes | No | Yes |
| Readable without lookup | Yes | No (requires DB) | Yes |
| Format | JSON | Random string | XML |
| Size | Medium | Small | Large |
| Stateless verification | Yes | No | Yes |
| Standard claims | Yes | No | Yes |
| Best for | APIs, SPAs | Simple sessions | Enterprise SSO |
Security Considerations for JWTs
JWTs Are Not Encrypted by Default
The payload of a standard JWT is only Base64URL encoded, not encrypted. Anyone who intercepts the token can decode and read its contents. Never store sensitive data such as passwords, credit card numbers, or personal information in a JWT payload unless you use JSON Web Encryption (JWE).
Always Verify the Signature
Decoding a JWT and reading its claims is not enough. You must also verify the signature to confirm the token was issued by a trusted source and has not been tampered with. A JWT Decoder helps you inspect the content, but your application server must verify the signature on every request.
Check the Expiration Claim
Always validate the exp claim server-side. A token with a past expiration timestamp must be rejected even if the signature is valid.
Watch Out for the Algorithm None Attack
Some early JWT libraries accepted tokens with "alg": "none" and no signature. An attacker could forge a token with any claims by setting the algorithm to none. Always explicitly specify and enforce the expected algorithm in your verification logic.
Use Short Expiry Times
JWTs cannot be invalidated after they are issued (unless you maintain a blocklist). Using short expiry times limits the damage if a token is stolen. Pair short-lived JWTs with refresh tokens for a balance between security and user experience.
Decoding a JWT Without a Tool
In a terminal, you can decode a JWT manually using basic command-line tools:
# Decode the payload section (second part)
echo "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ" | base64 -d
However, this requires handling Base64URL padding differences and does not format the JSON output. An online JWT decoder does all of this automatically and also converts timestamps to human-readable dates.
Manual Decoding vs Online JWT Decoder
| Task | Manual Approach | Online JWT Decoder |
|---|---|---|
| Split token into parts | Copy and split at dots manually | Automatic |
| Decode header | base64 decode in terminal | Instant formatted JSON |
| Decode payload | base64 decode in terminal | Instant formatted JSON |
| Read timestamps | Convert Unix time manually | Shown as human-readable dates |
| Verify signature | Write verification code | Paste secret or public key |
| Debug expired token | Check exp value by calculation | Highlighted with expiry date |
| Speed | Minutes | Seconds |
Tips for Working with JWTs
- Use an online JWT decoder during development and debugging to quickly inspect token contents without writing decode code.
- Never log full JWT tokens in application logs. If logs are compromised, valid tokens could be extracted and used.
- Store JWTs in HTTP-only cookies rather than localStorage to protect against XSS attacks that could steal tokens from JavaScript.
- Always validate both the signature and the standard claims (exp, iss, aud) on the server side, not just in the client application.
- Rotate your signing keys periodically and use the kid header claim to support multiple active keys during rotation.
- Keep JWT payloads small. Since tokens are sent with every request, large payloads increase bandwidth usage. Store only the minimum claims needed.
Conclusion
A JWT Decoder is an essential tool for any developer or security professional working with modern authentication and API systems. By instantly decoding the header and payload, converting timestamps to readable dates, and optionally verifying signatures, a JWT decoder removes the friction of manually inspecting tokens during development, debugging, and security review. Understanding the structure of a JWT, the meaning of its claims, and the security implications of how it is used helps you build more secure and reliable systems that your users can trust.
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Игры
- Gardening
- Health
- Главная
- Literature
- Music
- Networking
- Другое
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness