About the JWT Decoder
A JSON Web Token carries login and permission details in three Base64-encoded sections separated by dots: a header, a payload of claims and a signature. The first two are encoded, not encrypted, so anyone holding a token can read them. This JWT decoder shows the header and payload as formatted JSON and turns timestamps such as exp and iat into readable dates, which helps when debugging authentication. It does not verify signatures, so never trust a token's contents without server-side checks. For decoding other Base64 strings, use the Base64 Decoder, and for timestamps, the Timestamp Converter.
The time-based claims are usually what you came for. The three time claims are rewritten as calendar dates and clock times, and a status line reports whether the token is still current or how long ago it lapsed. The registered claim names are labelled as well, so it is obvious which value identifies the user, which names the service that issued the token and which states who it is intended for.
Checking the signature is left out on purpose. That step needs the signing secret or the public key, and getting into the habit of pasting signing secrets into web pages is how credentials end up leaked. Decoding shows you what a token claims about itself; only your own server, holding the key, can decide whether those claims are trustworthy.
How to use the JWT Decoder
- Paste the tokenUse the whole three-part string; spaces and a leading Bearer are stripped automatically.
- Look at the headerIt names the signing algorithm and the token type.
- Read the payloadClaims appear as indented JSON, with timestamps turned into dates.
- Check whether it has expiredThe status line says if the token is still current and exactly when it runs out.
JWT Decoder features
- Header and payload shown as indented JSON
- iat, nbf and exp turned into readable dates
- Plain statement of whether the token is still current
- Standard claim names such as sub, iss and aud explained
- Works with URL-safe Base64 and missing padding characters
- Helpful errors when a token is not the right shape
- Never sends the token anywhere and never asks for a signing key
Common uses
- Finding out why an API keeps answering 401 Unauthorized
- Checking which user, role or scope a token was issued for
- Seeing exactly when a session token stops working
- Inspecting the claims an identity provider really includes
- Learning how the three parts of a JWT fit together
JWTs in practice: reading claims, debugging 401 errors, storage choices, revocation and common attacks
JSON Web Tokens carry identity and permissions between a login service and the applications that trust it. Decoding a token shows exactly what it claims, which is the fastest way to debug authentication problems. This guide walks through decoding a sample token, explains the claims you will meet, covers the usual causes of rejected tokens, compares ways of storing tokens in browsers and explains revocation and well-known attacks.
A worked example: a sample token
A JWT has three parts separated by dots: a header, a payload and a signature, each encoded with Base64URL. The header eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 decodes to an object stating the algorithm HS256 and the type JWT. A payload beginning eyJzdWIiOiIxMDQyIiwibmFtZSI6IkF5ZXNoYSIs decodes to claims for user 1042, named Ayesha, issued at 1792939560 and expiring at 1792943160, exactly one hour later.
Seeing the issued and expiry times as dates immediately shows whether a token has expired, the most common reason for authentication errors.
Common claims
- sub: the subject, usually the user's ID.
- iss: the issuer, the service that created the token.
- aud: the audience, the application the token is meant for.
- exp, iat and nbf: expiry, issued-at and not-before times as Unix timestamps.
- scope or roles: permissions, in formats that vary between providers.
Applications should check the issuer and audience as well as the signature, so a token issued for one service cannot be used at another.
Debugging rejected tokens
When an API returns 401 Unauthorized, decoding the token usually reveals the cause: it has expired, the audience does not match the API, the issuer is different from the one configured, or a required scope is missing. Small clock differences between servers can also make a fresh token appear not yet valid, which is why many systems allow a minute or two of leeway.
Storing tokens in the browser
Tokens stored in localStorage are easy to use from JavaScript but can be stolen by a cross-site scripting attack. Tokens in httpOnly cookies cannot be read by scripts, which protects against that attack, but they need protection against cross-site request forgery. Many applications use short-lived access tokens in memory and refresh tokens in secure cookies to balance these risks.
Size limits
Tokens can grow large when they carry many claims or permissions. Cookies are limited to about 4 KB each, and very large headers can be rejected by servers and proxies. Keeping tokens lean, with detailed permissions looked up on the server, avoids these limits.
Revocation
A signed token stays valid until it expires, even if the user logs out or is disabled, because servers verify it without looking it up. Short expiry times limit the damage from stolen tokens, and refresh tokens can be revoked centrally. Systems needing immediate revocation keep a list of revoked token IDs or check a session store.
Known attacks
Early libraries accepted tokens with the algorithm set to "none", skipping signature checks, and some could be tricked into verifying an asymmetric token as if it used a shared secret. Modern libraries prevent these attacks when configured to accept only the expected algorithm. Always fix the allowed algorithm in server configuration rather than trusting the token's header.
Tokens are readable
A standard JWT is signed, not encrypted, so anyone holding it can read its payload. Personal or sensitive data should not be placed in tokens unless they are encrypted with the separate JWE format. Treat tokens like passwords and avoid pasting live production tokens into tools you do not trust.
Common mistakes
- Trusting a token's contents without verifying its signature on the server.
- Ignoring the audience and issuer claims.
- Storing long-lived tokens in localStorage.
- Putting sensitive personal data in the payload.
Related tools
To create test tokens, use JWT Encoder. To read timestamps, try Timestamp Converter, and to decode Base64 data, Base64 Decoder.
Base64URL encoding
JWT sections use Base64URL, a variant of Base64 that replaces plus and slash with hyphen and underscore and drops the trailing equals signs. Ordinary Base64 decoders may reject a token section or produce garbled output. A decoder built for JWTs handles these differences automatically, so the header and payload appear as readable JSON.
ID tokens and access tokens
Sign-in systems often issue two kinds of token. An ID token tells the client application who the user is, while an access token is meant for calling APIs. Sending an ID token to an API is a common mistake that causes audience errors. Some providers also issue opaque access tokens that are not JWTs at all and cannot be decoded.
Key IDs and rotation
A token header may include a kid value, the ID of the key used to sign it. Servers look up the matching public key from the provider's published key set. If verification suddenly fails after a provider rotates its keys, the server is usually holding an outdated cached copy of the key set and needs to refresh it.
Privacy
Tokens are decoded in your browser and never sent to a server. Even so, prefer test tokens over live production ones.
Frequently asked questions
Does decoding prove that a token is genuine?
No, and that is intentional. Proving authenticity takes the issuer's key, and typing keys into websites is a habit worth avoiding. Reading a token shows its contents; a server holding the key is the only thing that can vouch for them.
Are JSON Web Tokens encrypted?
Standard signed tokens are not. Their header and payload are only Base64-encoded, which anyone can reverse, so never place passwords, card numbers or other secrets in a payload: everyone who holds the token can read them.
What are exp, iat and nbf?
They are the expiry time, the time the token was issued and the earliest time it may be used. All three are stored as counts of seconds since 1970, so they look like arbitrary numbers until they are converted.
Why will my token not decode?
A token must have exactly three parts separated by full stops. Lose a section or a single character when copying and the decoder cannot continue. Tokens copied from log files or terminal windows are often cut short or wrapped across lines.
Can I safely check a token from my live system?
Nothing leaves this page: the three parts are unpacked by your own browser. Even so, a working token grants access just as a password does, so if one has been shared somewhere public, have it cancelled.
Can I see the signature part?
Yes, the third section is displayed as it is. Because it is raw binary encoded for use in web addresses, it looks like gibberish, and confirming it requires the matching key.