Decoded header
- Input
- eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
- Expected output
- {"alg":"HS256","typ":"JWT"}
`alg` declares the signing algorithm, but the server must validate that value, never accept it blindly.
JWT and authentication
A JWT looks like an opaque string, but it is just text encoded into 3 parts, visible to anyone who knows where to look. Understanding what each part does, and especially what the signature protects and what it does not, avoids the most common mistake: treating the token as if it were encrypted when it is only encoded.
`alg` declares the signing algorithm, but the server must validate that value, never accept it blindly.
`sub` identifies the user, `iat` marks when the token was issued in seconds since 1970; none of these fields is secret.
This is an HMAC-SHA256; recomputing it with the same secret and comparing byte for byte is the only valid way to verify the token.
Yes. This kind of utility is meant to show the token segments in a readable format for debugging and learning, and when applicable it can also help with local HMAC signature checks.
Not with standard encoding: Base64URL hides nothing, anyone can decode the payload without any secret; real confidentiality would require a JWE (JSON Web Encryption), a different standard from the common JWS that most systems use for authentication.
Because decoding and validating are separate steps: the token remains valid Base64URL after expiring, so the header and payload always decode; it is the server that must compare the `exp` claim against the current time and reject the request, the decoder itself does not enforce that rule.
HS256 uses a single shared secret for both signing and verifying, so any service that verifies tokens could also forge them; RS256 uses an RSA key pair, the private key signs and stays only with the issuer, the public key verifies and can circulate freely without the risk of forging a new token.
`iat` (issued at) records when the token was born and `exp` (expiration) marks how long it stays valid, both as a Unix timestamp in seconds; without `exp`, a stolen token would remain valid forever, so this claim is the main lifetime boundary for a session JWT.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQSflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c{
"alg": "HS256",
"typ": "JWT"
}{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022
}Token and secret stay in your browser. Do not share real JWTs through URLs, analytics or support channels.