Outils · Texte · Encoder et décoder du Base64 · Guides · Reading a JWT Payload Without a Library

Reading a JWT Payload Without a Library

4 min de lecture

A JWT is three Base64URL-encoded segments separated by dots: header.payload.signature. The middle segment, the payload, is plain JSON underneath the encoding - not encrypted, just encoded - so decoding it is the whole task, and it takes one paste rather than a library, a debugger, or a jwt.io-style third-party site you have to trust with a token that might belong to a real user.

A JWT's three segments, and which one to decode A JWT string split into three labeled parts joined by dots: header, payload and signature. An arrow points from the payload segment down to a decoded box showing readable JSON claims like sub, role and exp. header . payload . signature "sub": "user_412" "role": "editor" "exp": 1755638400
The signature confirms the token wasn't forged. It does nothing to hide the payload from you.

Why the payload segment is readable by design

A JWT's whole point is that a server can trust a token's claims without a database lookup on every request, and that only works if the claims are easy to read back out - encrypting the payload would defeat that design, so it stays as Base64URL-encoded JSON instead. The signature exists to prove the token wasn't tampered with after it was issued, not to hide what's inside it. That distinction matters in practice: anyone who has a JWT, including a browser's own DevTools showing it in a request header, can read the user ID, role, expiry time and any other claim packed into it, whether or not they have the server's signing key.

Decoding the payload segment

Copy just the middle segment - the text between the first and second dot - and paste it into the Base64 tool in Decode mode. JWTs use the URL-safe Base64 variant (- and _ instead of + and /, no padding) rather than standard Base64, and Decode reads both, so there is nothing to tick. The result is the raw JSON claims: things like sub (the subject, usually a user ID), role or scope, iat (when the token was issued) and exp (an expiry timestamp in Unix seconds). If it comes out as one dense unformatted line, running it through a JSON formatter next makes it readable at a glance.

The first segment, the header, decodes the same way and is usually shorter and less interesting - typically just alg (the signing algorithm, commonly HS256 or RS256) and typ ("JWT"). It's worth a glance mainly to confirm which signing algorithm is in play if you're debugging a signature-verification failure elsewhere, rather than for anything it tells you about the user or the session.

The exp claim is worth reading carefully once decoded: it's a Unix timestamp - seconds since 1 January 1970, not milliseconds - so a value like 1755638400 needs converting to a real date before it means anything at a glance. A token that has already expired by that timestamp being accepted by a server anyway is a real, checkable sign that the server isn't validating expiry at all, and decoding the payload locally is how you'd notice that without needing backend access to confirm it.

What this does and doesn't tell you

Decoding the payload tells you exactly what claims a token carries and lets you check things like whether it has already expired, without needing server access or a debugger attached to a running request. It does not tell you whether the token is genuinely valid - that check depends on verifying the signature against the server's actual signing key, which this tool deliberately does not attempt, since a real signature check needs the private key material this tool has no business asking for. Reading a payload and verifying a signature are two different jobs; this covers the first one.

A production token carries real session claims, which is exactly the case where pasting it into an unfamiliar third-party site is worth pausing over - a site that decodes JWTs "for you" could just as easily be logging every token it's handed. Decoding it in a tool that runs entirely in the tab and sends nothing anywhere removes that specific worry without changing anything about what you can actually check.

If the distinction between "readable" and "secure" is new information, the why guide covers it directly - this JWT case is exactly the situation it's warning about. For the mechanics of encoding and decoding generally, including the URL-safe option used above, see the how-to guide.

The token you paste here is never uploaded - decoding happens in your browser, which matters more than usual for a value that can carry a real user's session claims.

Essayer Encoder et décoder du Base64 gratuitement Encoder et décoder du Base64

Outils similaires