Base64 Encode & Decode · Tutorial

How to decode a JWT and read its payload

6 min readbeginnerUpdated

When a login or API call fails, the answer is often inside the token itself. Maybe it has expired, or it lacks a role. A JWT is just three Base64-encoded parts joined by dots. This tutorial shows how to decode one safely, read the claims that matter, and convert its timestamps into real dates.

What you need

  • The Base64 Encode & Decode
  • A JWT, for example from your browser's developer tools, an Authorization: Bearer header, or the sample behind Try it

Steps

  1. Copy the token

    A JWT looks like xxxxx.yyyyy.zzzzz: three groups of letters, digits, - and _, separated by dots. If you copied a header such as Authorization: Bearer eyJ..., keep only the part after Bearer .

  2. Paste it into the decoder

    Paste the whole token into the left box. The tool recognises the three-part shape, decodes the first two parts as URL-safe Base64, and formats each as JSON. A green note confirms it was read as a JWT.

  3. Read the header

    The header describes how the token was signed. alg is the signing algorithm (for example HS256 or RS256) and typ is usually JWT. You rarely need to change anything here, but an unexpected algorithm can explain why a server rejects a token.

  4. Read the payload claims

    The payload holds the claims: facts the issuer vouches for. Common ones are sub (the user or subject ID), exp (expiry time), iat (issued at), and app-specific claims like role or scope. In the sample, the user user_8841 has the role editor.

    {
      "sub": "user_8841",
      "name": "Sam Rivera",
      "role": "editor",
      "iat": 1793260800,
      "exp": 1793264400
    }
  5. Convert the timestamps

    iat and exp are Unix timestamps: seconds since 1 January 1970 UTC. In the sample, exp is exactly 3,600 seconds after iat, so the token was valid for one hour. If exp is in the past, the token has expired and the user must log in again or refresh it. A quick check in your browser console is new Date(1793264400 * 1000).

Try it yourself

Opens the Base64 Encode & Decode with this tutorial's sample loaded.

Try it now

Common mistakes

Including the Bearer prefix or quotes
Extra text such as Bearer or surrounding quotation marks stops the tool from recognising the token. Paste only the three dot-separated parts.
Assuming a decoded token is valid
Anyone can create a token with any payload. Decoding shows what it says, not whether it is genuine. Only signature verification on the server proves that.
Pasting production tokens into online tools that upload them
A live token can be used to act as that user until it expires. This decoder runs in your browser, but be careful with any site that sends input to a server.

Next steps

Go back to the Base64 Encode & Decode, or keep going with one of these:

FAQ

Why can't I decode the third part?

The third part is the signature, which is raw binary produced by the signing algorithm. It is not meant to be read, only verified with the right key.

Can I edit the payload and use the token?

Changing the payload breaks the signature, so a correctly configured server will reject the edited token.