Skip to content

JWT decoder

Paste a JSON Web Token to read its header and claims, with every time claim shown as a date and how long ago or from now it is.

Runs in your browser. Nothing you paste is sent to us.

Token

A sample Keycloak access token is filled in. Paste yours; it stays in your browser.

Not expired
Expires in 1208 days, at 2030-03-17T17:51:40Z (3/17/2030, 5:51:40 PM).

RS256 kid sample-key Bearer

Decoded

Header
{
  "alg": "RS256",
  "typ": "JWT",
  "kid": "sample-key"
}
Payload
{
  "exp": 1900000300,
  "iat": 1900000000,
  "jti": "6d2f05f2-sample",
  "iss": "https://auth.example.com/realms/acme",
  "aud": "account",
  "sub": "1f8f4b3a-sample",
  "typ": "Bearer",
  "azp": "web-app",
  "scope": "openid profile email",
  "realm_access": {
    "roles": [
      "user"
    ]
  },
  "preferred_username": "alice"
}
exp
2030-03-17T17:51:40Z (3/17/2030, 5:51:40 PM)in 1208 days
iat
2030-03-17T17:46:40Z (3/17/2030, 5:46:40 PM)in 1208 days
Decoding does not check the signature. Use the signature verifier to check it against your realm’s key.

How to use it

  1. Paste the token, with or without the word Bearer in front.
  2. Read the header for the signing algorithm (alg) and key id (kid).
  3. Read the payload for the issuer, audience, subject, roles and scopes.
  4. Check the expiry line to see whether the token is still valid.

What to know

A JWT is three Base64url parts joined by dots: a header, a payload of claims, and a signature. Anyone can read the first two; only the signature proves who issued the token.

Keycloak access tokens carry the issuer as https://<host>/realms/<realm>, the client that asked for the token in azp, realm roles in realm_access and client roles in resource_access.

Decoding happens in your browser. Even so, treat a live token like a password: it works until it expires.

What a JSON Web Token is

A JSON Web Token (JWT, RFC 7519) is a compact way to pass a set of claims from one party to another. A claim is a single statement, such as who the user is, who issued the token, or when it stops being valid.

Most JWTs you meet are signed, not encrypted. The signature lets the receiver check who issued the token and that nobody changed it. It does not hide anything. Anyone who holds a signed token can read every claim in it.

Identity providers such as Keycloak issue JWTs as access tokens and ID tokens. Your apps and APIs read them on every request, so being able to look inside one quickly saves a lot of guessing.

How decoding works

A signed JWT in compact form is three parts joined by dots: a header, a payload and a signature. The header and payload are JSON, encoded with Base64url. The signature is raw bytes, also Base64url-encoded.

PartContainsReadable?
HeaderThe algorithm (alg), the key id (kid), the type (typ)Yes, it is JSON
PayloadThe claims: issuer, subject, audience, times, rolesYes, it is JSON
SignatureBytes computed over the first two parts with a keyNo, it is binary

Decoding means splitting on the dots, turning each Base64url part back into bytes, and reading the bytes as UTF-8 JSON. No key is involved, which is why any tool, including this one, can do it.

Decoding a JWT in plain JavaScript (padding omitted for brevity)
const [header, payload] = token.split('.');
const json = (part) =>
  JSON.parse(new TextDecoder().decode(
    Uint8Array.from(atob(part.replace(/-/g, '+').replace(/_/g, '/')), (c) => c.charCodeAt(0)),
  ));
console.log(json(header), json(payload));

What this decoder shows, and what it does not

The decoder shows the header and payload as formatted JSON, the signing algorithm and key id as badges, and every time claim as a date with how long ago or from now it is. It tells you at a glance whether the token has expired.

It does not check the signature. A token whose payload someone edited by hand decodes just as cleanly as a genuine one. To know a token is real, check its signature with the signature verifier, then check its claims with the claims validator.

It also cannot read encrypted tokens. Those have five parts instead of three, and their payload is ciphertext. The JWE header inspector shows what can be read from them.

How to decode a token

  1. Copy the token from where your app keeps it: an Authorization header in your browser’s network tab, a log line, or a test.
  2. Paste it into the box. The word Bearer in front is fine; it is removed before decoding.
  3. Read the header badges for the algorithm and key id.
  4. Read the payload for the issuer, audience, subject, roles and scopes.
  5. Check the expiry line and the list of time claims.

The page decodes as you type, so you can also edit a token to see where it breaks. Nothing you paste leaves your browser.

Reading the header

The header says how the token was signed. Three fields matter most.

  • alg: the signing algorithm. RS256 is an RSA signature with SHA-256, ES256 an elliptic-curve signature, HS256 an HMAC with a shared secret. none means the token is not signed at all and must be rejected.
  • kid: the id of the key that signed the token. A verifier uses it to pick the right public key from the issuer’s key set.
  • typ: the media type of the token, usually JWT. Some issuers use at+jwt for access tokens (RFC 9068).

Fields such as jku, x5u or jwk in the header point to or carry a key. A verifier should not trust a key that the token supplies about itself; the security checker flags these.

Reading the payload

RFC 7519 registers a small set of claim names. Everything else is defined by the issuer.

ClaimMeaning
issIssuer: who created and signed the token
subSubject: who the token is about, usually a user id
audAudience: who the token is meant for; a string or a list
expExpiry time, in seconds since 1970
nbfNot before: the token is not valid earlier than this
iatIssued at: when the token was created
jtiA unique id for this token

Claims Keycloak adds

A Keycloak access token also carries azp (the client that asked for the token), typ (Bearer for access tokens, ID for ID tokens), scope, sid (the session), realm_access.roles (realm roles), resource_access (client roles, by client id) and user details such as preferred_username, depending on the client scopes the client uses.

The issuer has the form https://<host>/realms/<realm>. If you run several realms, the last part of iss tells you at once which realm issued a token. The token roles viewer lays out the role claims client by client.

Times in a token

JWT times are Unix seconds in UTC, not milliseconds. A value such as 1764000000 is a moment in late 2025. If a number has 13 digits, it is milliseconds and the issuer made a mistake, or you are looking at something other than a JWT claim.

The decoder shows exp, iat, nbf, auth_time and updated_at as dates in UTC and in your local time. For a timeline with a live countdown, use the expiry checker; to convert a single value, use the Unix timestamp converter.

Where decoding helps

Most token problems are visible in the claims long before you need a debugger.

A request fails with 401 or 403

Decode the token the client sent. Check that exp is in the future, that iss is the issuer your API trusts, and that aud names your API. A token for the wrong realm, the wrong environment or the wrong audience looks fine until you read it.

A user is missing a permission

Look at realm_access.roles and resource_access. If the role is not in the token, your API cannot see it, whatever the admin console shows. The cause is often a client scope or a scope mapping, not the user.

Two environments behave differently

Decode a token from each and compare them with the JWT compare tool. Differences in issuer, audience, mappers or lifetime usually explain the difference in behavior.

Writing tests and documentation

Decoding a real test token shows the exact shape your code must handle: whether aud is a string or a list, which claims are present, and how roles are nested.

Access, ID and refresh tokens in Keycloak

Keycloak issues three kinds of token in the OpenID Connect flows, and they are meant for different readers.

Token`typ` claimMeant for
Access tokenBearerYour APIs, sent in the Authorization header
ID tokenIDThe client app, to learn who signed in
Refresh tokenRefresh or OfflineKeycloak only, to get new tokens

You can decode all three, but treat the refresh token as opaque in your own code. Keycloak signs it with a realm secret it does not publish, so only Keycloak can check it.

Common decoding errors

“A JWT has 3 parts”

The text has too few or too many dots. Copying from a log often cuts the token short or joins it to the next field. Copy it again from the source.

“This is an encrypted token”

The token has five parts, so it is a JWE. Its claims cannot be read without the recipient’s private key.

“Not Base64url-encoded JSON”

A part contains characters outside the Base64url alphabet, often a stray quote, a space or a line break added by an email client or a terminal. Opaque tokens, which some servers issue instead of JWTs, also fail here because they are not JWTs at all.

What is safe to paste

This page decodes in your browser and sends nothing to us. Even so, a live access token works for anyone who holds it until it expires. Prefer tokens from a test realm, or expired ones.

Never paste refresh tokens or offline tokens from production into any website. They can live for days or longer and can be exchanged for new access tokens.

Decoding is not verification. A decoded token tells you what it claims, not whether those claims are true.

Best practices

  • In your API, always verify the signature with keys you fetched from the issuer, then check exp, iss and aud.
  • Never make access decisions from a token you only decoded.
  • Keep tokens out of URLs and logs. If you must log one, log its jti or a hash instead.
  • Keep access tokens short-lived and refresh them, rather than issuing long-lived ones.
Questions

Frequently asked questions

Does decoding a JWT check that it is valid?

No. Decoding only reads the header and payload, which anyone can do. To know a token is genuine, verify its signature with the issuer’s public key, then check `exp`, `nbf`, `iss` and `aud`.

Is it safe to paste a token here?

The token is decoded in your browser and nothing is sent to us. A live token still grants access until it expires, so prefer test tokens or expired ones, and never paste production refresh tokens anywhere.

Can I decode a JWT without the secret or key?

Yes. The header and payload are only Base64url-encoded, not encrypted. The key is needed to verify the signature, not to read the claims.

Why can’t I read an encrypted token?

An encrypted JWT (JWE) has five parts and its payload is ciphertext. Only the holder of the decryption key can read the claims. You can still read its header with the JWE header inspector.

Why is `aud` sometimes a string and sometimes a list?

RFC 7519 allows both. A token for one audience may carry a single string, and a token for several carries an array. Code that reads `aud` should accept either form.

What do `realm_access` and `resource_access` mean?

They are Keycloak’s role claims. `realm_access.roles` lists the user’s realm roles that the client may see, and `resource_access` lists client roles grouped by client id.

Why is the expiry shown as expired when the token is new?

Usually the clock on your computer or on the issuer is wrong, or the token was issued long ago and copied from a log. Compare `iat` with the current time to see which.

Can I decode a Keycloak refresh token?

Yes, Keycloak refresh tokens are JWTs and decode like any other. Your code should still treat them as opaque, because only Keycloak can verify them and their contents may change between versions.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.