Decode
Generate
JWT Token
Verification Key/Secret
Optional - leave empty for decode only
Security: Algorithm is read from token header. For production, always verify against a known expected algorithm to prevent algorithm confusion attacks.
Header
-
Payload
-
Signature
-
Token Status
exp:
-
nbf:
-
iat:
-
Header
CRITICAL: Tokens with "none" algorithm have NO signature and should NEVER be used in production. They provide no security guarantees.
Payload
Signing Key/Secret
Generated JWT
About JSON Web Tokens (JWT)
JSON Web Tokens (JWT), defined in RFC 7519, are compact, URL-safe tokens used to securely transmit claims between two parties. They are widely used for authentication and authorization in web applications and APIs.
JWT Structure
A JWT consists of three Base64URL-encoded parts separated by dots: header.payload.signature
- Header - declares the token type (JWT) and the signing algorithm (e.g. HS256, RS256).
- Payload - contains the claims (data), such as user identity and expiration time.
- Signature - verifies the token hasn't been tampered with, created by signing the header and payload with a secret or private key.
Common JWT Claims
| Claim | Name | Description |
|---|---|---|
sub | Subject | Identifies the principal (usually a user ID) |
iss | Issuer | Who issued the token |
aud | Audience | Intended recipient(s) of the token |
exp | Expiration | Unix timestamp after which the token is invalid |
iat | Issued At | Unix timestamp when the token was created |
nbf | Not Before | Unix timestamp before which the token is not valid |
jti | JWT ID | Unique identifier to prevent token reuse |
Signing Algorithms Compared
| Algorithm | Type | Best For |
|---|---|---|
HS256 | Symmetric (HMAC-SHA256) | Simple setups where signer and verifier share a secret |
RS256 | Asymmetric (RSA-SHA256) | Distributed systems where verifiers shouldn't have signing access |
ES256 | Asymmetric (ECDSA-P256) | Like RS256 but with smaller keys and faster signing |
Security Best Practices
- Always verify the signature before trusting any claims in the payload.
- Don't store sensitive data in the payload - JWTs are encoded, not encrypted. Anyone can read the contents.
- Use short expiry times (
exp) and refresh tokens for long-lived sessions. - Reject the "none" algorithm in your verification logic to prevent signature bypass attacks.
- Validate the expected algorithm on the server side rather than trusting the token's header.