How to Decode JWT Tokens Without a Backend
If you've worked with authentication (OAuth, OpenID Connect, or any modern API), you've almost certainly encountered JWT(JSON Web Tokens). They're everywhere โ but they can feel like a black box.
The good news: you don't need a backend to inspect a JWT. Since JWTs are base64url-encoded JSON, you can decode them entirely in your browser. In fact, that's the safest way to do it โ your token data never leaves your machine.
๐ Quick Try
Decode any JWT instantly with our free JWT Decoder tool โ all client-side, no server uploads.
What is a JWT?
A JSON Web Token is a compact, URL-safe way to represent claims between two parties. A JWT looks like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5cIt has three parts, separated by dots: Header.Payload.Signature
Part 1: The Header
The header tells you howthe token was created. Decode the first segment from base64url, and you'll get something like:
{
"alg": "HS256",
"typ": "JWT"
}Key fields:
- alg (Algorithm) โ The signing algorithm. Common values: HS256 (HMAC+SHA256), RS256 (RSA+SHA256), EdDSA
- typ (Type) โ Usually "JWT"
- kid (Key ID) โ Optional. Identifies which key was used to sign
Part 2: The Payload (Claims)
This is the data part โ the actual claims the token carries. Standardized claims (registered claim names) include:
| Claim | Name | Description |
|---|---|---|
| iss | Issuer | Who created the token |
| sub | Subject | Who/what the token is about (usually a user ID) |
| aud | Audience | Who should accept this token |
| exp | Expiration | Unix timestamp when token expires |
| nbf | Not Before | Token is not valid before this time |
| iat | Issued At | When the token was issued |
| jti | JWT ID | Unique identifier (prevents replay attacks) |
Custom claims (like role, permissions, or email) are also common. Use our JWT Decoder to see exactly what your token contains.
Part 3: The Signature
The signature verifies that the token hasn't been tampered with. It's created by taking the header + payload, signing them with a secret key (for HMAC) or private key (for RSA/ECDSA), and base64url-encoding the result.
signature = HMACSHA256(
base64urlEncode(header) + "." + base64urlEncode(payload),
secretOrPrivateKey
)โ ๏ธ Important:Decoding a JWT does NOT verify the signature. You can read the payload without the secret key, but you need the server's secret to confirm the token is authentic. Never trust a decoded JWT without verification.
How to Decode a JWT Step by Step
You only need 3 steps. No server, no libraries:
- 1
Split by dots
Take your JWT and split on "." โ you get three parts:
[header, payload, signature] - 2
Base64url decode the payload
Convert from base64url (use
atob()in JS, but first replace-with+and_with/) - 3
Parse as JSON
JSON.parse()the decoded string โ now you can read every claim
Or just use our JWT Decoder and paste your token โ it does all three steps instantly, with syntax-highlighted output and expiration status.
Common JWT Security Pitfalls
1. The "none" Algorithm Attack
Older JWT libraries had a vulnerability where an attacker could change the algorithm to"none" and bypass signature verification. Alwayswhitelist expected algorithms on the server side.
2. Storing JWTs in localStorage
While convenient, localStorage is accessible to any JavaScript running on the same origin. If your site has an XSS vulnerability, tokens can be stolen. Consider HttpOnly cookiesfor production applications.
3. Not Checking the exp Claim
Always verify the exp (expiration) claim on the server. An expired token should be rejected. Use our Timestamp Converterto check if a token's exp timestamp is still valid.
4. Decoding Without Verifying
This bears repeating: anyone can decode a JWT. The security comes fromverifying the signature, which requires the server's secret key. Client-side tools like our JWT Decoder are great for debugging and inspection, but never trust the decoded data for authorization decisions.
Debugging JWTs Like a Pro
When debugging authentication issues, here's what to check with a JWT decoder:
- Is the token expired? Check the
expclaim against the current time - Is the issuer correct? Verify the
issclaim matches your auth server - Is the audience correct? Check
audโ your API should verify it - Are custom claims present? If your API expects a
roleorpermissionsclaim, confirm it's there
Use our free JWT Decoder to inspect tokens quickly โ it runs entirely in your browser, so your tokens stay private.
Related Tools: JWT Decoder ยท Base64 Encoder/Decoder ยท Timestamp Converter