What Is a JWT?
A JSON Web Token (JWT), pronounced "jot", is a compact, URL-safe way of passing signed information between systems, defined in RFC 7519. JWTs are the standard format for access tokens in OAuth 2.0 and OpenID Connect, and are used by Auth0, Firebase, AWS Cognito, Azure AD, Okta, Supabase and countless custom APIs. When you log in to a modern web or mobile app, the server usually gives you a JWT that proves who you are on every subsequent request.
A JWT has three parts separated by dots, each Base64url-encoded: the header (the algorithm and token type), the payload (the claims: who the user is, what they can do, when the token expires) and the signature (proof that the token was issued by the server and hasn't been changed). This JWT decoder reveals the header and payload, which are only encoded, not encrypted, and can check the signature.
How to Decode a JWT
- Paste your token. A "Bearer " prefix from an Authorization header is removed automatically.
- Read the decoded header and payload as formatted JSON.
- Check the claims table. Standard claims are explained, and timestamps are converted to your local time.
- See the status: whether the token is expired, not yet valid, or unsigned.
- Optional: verify the signature with the secret (HS algorithms) or the public key (RS, PS and ES algorithms).
Standard JWT Claims
| Claim | Name | Meaning |
|---|---|---|
iss | Issuer | Who created and signed the token |
sub | Subject | Who the token is about, usually the user ID |
aud | Audience | Which application or API the token is for |
exp | Expiration time | Unix timestamp after which the token must be rejected |
nbf | Not before | The token isn't valid before this time |
iat | Issued at | When the token was created |
jti | JWT ID | A unique identifier, used to prevent replay |
Signing Algorithms
- HS256 / HS384 / HS512: HMAC with a shared secret. The same secret signs and verifies, so it must stay private on the server.
- RS256 / RS384 / RS512: RSA signatures. The private key signs and the public key verifies. Common with identity providers, which publish their keys in a JWKS endpoint.
- PS256…: RSA-PSS, a more modern RSA padding scheme.
- ES256 / ES384 / ES512: elliptic-curve (ECDSA) signatures, which are smaller and faster.
JWT Security Tips
- Never put secrets in a JWT payload. Anyone holding the token can read it, as this tool shows.
- Always verify the signature on the server, and reject
alg: nonetokens. - Pin the expected algorithm to avoid algorithm-confusion attacks.
- Keep access tokens short-lived (minutes to an hour), and use refresh tokens for longer sessions.
- Check
iss,audandexpon every request. - Treat tokens like passwords. This tool decodes locally, but avoid pasting live production tokens into unknown websites.
Where JWTs Are Stored
Web apps commonly keep tokens in an HttpOnly, Secure cookie, which JavaScript can't read, protecting it from XSS theft. Alternatively they keep tokens in memory and send them in the Authorization: Bearer header. Storing long-lived tokens in localStorage is discouraged, because any injected script can read them. Mobile apps use the platform's secure storage (Keychain or Keystore). Whatever you choose, keep access tokens short-lived, and revoke refresh tokens when users log out or change their password.
Debugging Authentication Errors
When an API returns 401, decode the token here and check three things first: whether exp has passed, whether aud matches the API you're calling, and whether iss is the expected identity provider. Clock differences between servers can also cause tokens to appear expired or not yet valid, so most libraries allow a small leeway of a minute or two.
Frequently Asked Questions
Is it safe to decode a JWT here?
Yes. Decoding and verification happen entirely in your browser, and nothing is transmitted.
Can a JWT payload be read without the secret?
Yes. It's only Base64url-encoded. The secret is needed to create or verify the signature, not to read it.
What does "Invalid signature" mean?
The secret or public key is wrong, or the token was altered after signing.
How do I decode a JWT in JavaScript?
JSON.parse(atob(token.split('.')[1].replace(/-/g,'+').replace(/_/g,'/'))). For verification, use a library such as jose.
What is a JWE?
An encrypted JWT with five parts. Its payload can't be read without the decryption key.