JWT Decoder Security Guide: How to Decode and Debug JSON Web Tokens (2026)

A hands-on, tool-first walkthrough: paste a token, read the header, payload, and signature, understand every registered claim, decode safely, and fix the base64url errors that break real-world debugging sessions.

By NoCostTools Editorial Team Updated October 22, 2026 14 min read Web Security
JWT decoder walkthrough showing a JSON Web Token split into header, payload, and signature

What a JWT Actually Is (and Why Decoding It Matters)

JSON Web Tokens are defined by RFC 7519 and have become the default way web and mobile apps prove who you are to an API. A JWT is a compact, URL-safe string with three dot-separated parts. It arrives in an Authorization: Bearer header, sometimes in a cookie, and — after you sign in — it is the credential your browser presents on every request.

Here is the single most important fact for anyone opening a decoder for the first time: JWTs are encoded, not encrypted. Base64url encoding turns JSON into URL-safe text; it does not hide it. Anyone who holds a token can read its entire header and payload. Decoding is the reverse of a reversible operation — no key required. Encryption, by contrast, needs a key to undo. This is the top beginner misconception, and it is exactly why a decoder is such an effective learning and debugging tool.

It is also why handling matters. A JWT is a bearer credential: whoever carries it can use it. That is why current OAuth 2.1 draft guidance favors short-lived access tokens, and why passkeys and FIDO2 credentials have gone mainstream for the login step itself — but once the session is established, bearer JWTs remain everywhere. In 2026 the practical skill set has not changed: know how to read a token, know what each claim means, and know how to do it without leaking a live credential.

When you actually need a decoder

  • Debugging a 401: is the token expired, or is the audience wrong? Decode and look at exp and aud.
  • Verifying what your auth server emits: confirm the iss value and the alg your stack really uses.
  • Learning and demos: walk teammates through token structure with a test token that carries fictional data.
  • Incident triage: establish which claims a suspicious token carried — with a redacted copy, never a production token.

Our free JWT decoder runs entirely in your browser: the token you paste never leaves the page. It sits inside our wider free security tools guide, alongside the password, hashing, and auditing tools referenced throughout this article. If you are completely new to tokens, start with JWT basics for beginners, then come back here for the hands-on walkthrough.

JWT Anatomy: Header, Payload, and Signature

Every JWT — signed or not — follows the same template: header.payload.signature. A decoder splits the string at the dots, base64url-decodes the first two segments into JSON, and leaves the third as opaque bytes. Knowing what each part contains tells you where to look when something breaks.

The three-part structure at a glance

1. Header — algorithm and token type

{
  "alg": "HS256",
  "typ": "JWT"
}
  • alg: the signing algorithm — HS256, RS256, ES256, PS256, or (dangerously) none
  • typ: almost always JWT
  • Security note: the header is base64url-encoded text, readable by anyone

2. Payload — claims and data

{
  "iss": "https://auth.example-test.dev",
  "sub": "user_24601",
  "aud": "shop-frontend",
  "exp": 1792713600,
  "iat": 1792627200
}
  • Registered claims: iss, sub, aud, exp, nbf, iat, jti (covered below)
  • Custom claims: application-specific data such as roles or plan tiers
  • Security note: the payload is fully readable by anyone holding the token — never put secrets here

3. Signature — the integrity check

HMACSHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  secret)

The signature is computed over the encoded header and payload using a key. It is what makes a JWT tamper-evident: change one claim and the signature no longer matches. Decoding shows you the signature string; verifying it requires the key, which a browser decoder does not have.

Remember: encoding is not encryption. The signature provides integrity, not confidentiality. Anyone can read every claim — plan payloads accordingly.

Because the first two segments are plain base64url, you can cross-check a decoder's output with any standalone Base64 encoder/decoder. If the two tools disagree, the token — not the decoder — is your problem.

Registered Claims Reference: iss, sub, aud, exp, nbf, iat, jti

The JWT specification reserves a small set of claim names, and they are the seven fields you will check most often in a decoder. All of the timestamp claims are Unix epoch seconds in UTC — a good decoder converts them into human-readable dates for you.

Claim Full name What it tells you What to check in the decoder
iss Issuer Who created and signed the token It matches the identity provider you expect — treat a mismatch as a broken configuration
sub Subject The user or resource the token is about Prefer a stable, non-sensitive ID — an email address in sub leaks more than you need
aud Audience Which service should accept the token Your API's identifier is present; wrong audience is a classic cause of 401s
exp Expiration Unix timestamp when the token stops working It lies in the future; note that it is UTC, not your local timezone
nbf Not before Earliest moment the token is valid It is not accidentally set in the future — a common cause of "valid token, still rejected"
iat Issued at When the token was created The gap between iat and exp matches the lifetime you intended
jti JWT ID A unique identifier for this specific token It is unique per token — useful for revocation lists, logs, and tracing duplicates

Custom claims — with a confidentiality warning

Beyond the registered seven, applications add custom claims: roles, plan, tenant_id, locale, and so on. Two rules keep custom claims safe. First, keep the payload minimal — every extra field is data you must justify exposing. Second, never place anything secret in the payload: no passwords, no API keys, no raw personal data. When you generate test tokens for demos, give each one a fresh jti — the UUID generator produces well-formed identifiers for exactly this purpose.

Checking the alg Field: HS256, RS256, and Beyond

The alg field in the decoded header tells you how the signature was produced, and therefore what kind of key verification needs. It is the first thing a reviewer looks at after pasting a token — and one of the few fields where a surprise value is genuinely worth stopping for.

alg value Family Keys Typical use What to watch for
HS256 HMAC + SHA-256 One shared secret Single service, internal APIs Weak or leaked secrets — every verifier can also mint tokens
RS256 RSA + SHA-256 Private key signs, public key verifies Microservices, public APIs Key mix-ups between signing and verification
ES256 ECDSA + SHA-256 (P-256) Asymmetric, small keys Mobile apps, IoT devices Library support varies across platforms
PS256 RSA-PSS + SHA-256 Asymmetric with padding High-security applications Not supported by every JWT library
none No signature N/A Nothing — never in production Any token claiming none should be rejected outright

Reading alg like a reviewer

When you paste a token into the decoder, ask three questions about alg. First, is it what your system expects? If your API issues RS256 tokens and you are holding an HS256 token, something is misconfigured. Second, is it none? A token with alg: none has no integrity protection at all — libraries must reject it explicitly, and decoders will happily show you such a token because decoding is not validation. Third, does the algorithm match the key material you know the service uses? The historical pitfalls here — accepting unsigned tokens and symmetric/asymmetric algorithm confusion between HS256 and RS256 — are classic real-world lessons; we cover the defensive, server-side side of that story in advanced JWT hardening.

One related clarification worth making: hashing and signing are different jobs. HS256 and RS256 sign tokens using SHA-256 internally — you can inspect the digest itself with a SHA-256 hash generator. Older digests such as MD5 (see the MD5 hash generator for comparison) belong to a legacy era and should not appear anywhere in a modern token pipeline.

Decoder tip: a decoder never validates a signature — it only displays the token. Seeing alg: none in a decoded header is a red flag to investigate in your server configuration, not proof the token is malicious or safe.

Using the JWT Decoder: A Sample Token Walkthrough

Nothing beats doing it. The token below was created specifically for this tutorial: every value is fictional, and it is signed with a throwaway key — so it is safe to paste into any tool, take screenshots of, and keep in your test suite.

Step by step

  1. Start with a token you are allowed to inspect. Use the test token below — never a production token from a real application.
  2. Open the JWT decoder. It runs client-side, so nothing is transmitted.
  3. Paste the full token into the input box. The tool splits the three segments at the dots automatically.
  4. Read the header. Confirm alg and typ match what you expect.
  5. Read the payload. Walk the claims: iss, sub, aud, then the timestamps exp, nbf, iat, and jti.
  6. Treat the signature as opaque. Decoding displays it; verifying it is a separate step that needs the key.

The sample test token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS10ZXN0LmRldiIsInN1YiI6InVzZXJfMjQ2MDEiLCJhdWQiOiJzaG9wLWZyb250ZW5kIiwiZXhwIjoxNzkyNzEzNjAwLCJuYmYiOjE3OTI2MjcyMDAsImlhdCI6MTc5MjYyNzIwMCwianRpIjoiN2Y5ZDJjNGUtOGExYi00ZTZmLTljM2QtNWI3YTFlMmY0YThjIn0.ldKH-bZ8XiyB75tjx8KC5YtmH74Tg-jzNI9F1z3NI8g

What the decoder shows you

Segment one decodes to this header:

{
  "alg": "HS256",
  "typ": "JWT"
}

Segment two decodes to this payload:

{
  "iss": "https://auth.example-test.dev",
  "sub": "user_24601",
  "aud": "shop-frontend",
  "exp": 1792713600,
  "nbf": 1792627200,
  "iat": 1792627200,
  "jti": "7f9d2c4e-8a1b-4e6f-9c3d-5b7a1e2f4a8c"
}

Things worth noticing as you read it back:

  • iat and nbf — 1792627200 — convert to October 22, 2026, 00:00:00 UTC: issued at the stroke of midnight UTC.
  • exp — 1792713600 — converts to October 23, 2026, 00:00:00 UTC: exactly a 24-hour lifetime, a common development-setting test window (production access tokens should live minutes, not days).
  • sub is user_24601, not an email — deliberately boring and non-sensitive.
  • jti is a UUID, unique to this token, ready for a revocation list or a log line.
  • aud is shop-frontend, the only service meant to accept this token.

About the signature

Segment three, ldKH-bZ8XiyB75tjx8KC5YtmH74Tg-jzNI9F1z3NI8g, is base64url-encoded raw HMAC-SHA256 output — 32 bytes you cannot meaningfully "read". Because this is a demo, we can tell you the secret: demo-signing-key-do-not-use-in-production. If you compute HMAC-SHA256 over header.payload with that secret (any local HMAC utility or a hash generator workflow will do), you will reproduce the exact signature above — a satisfying way to see that signature verification is nothing mysterious. With a real token you obviously will not have the secret, which is precisely the point: verification happens in your backend, where the key lives.

Debugging Common Decode Errors

Most "broken token" mysteries reduce to a handful of causes. The table below maps the symptoms you will see in a decoder or in your own parsing code to the likely cause and the fix.

Symptom What it looks like Likely cause How to fix it
Not enough segments Only two parts, or a single long string with no dots Truncated copy — the signature was never copied Copy the entire token from the source, including all three dot-separated parts
Invalid character during base64 decode A +, /, or = inside a segment Standard base64 instead of base64url, or an edited token JWTs use base64url (- and _, no padding); re-copy the token unmodified
Unexpected token / invalid JSON Segment decodes but is not valid JSON Partial segment pasted, or the token was pasted twice Paste the whole token once; check for stray characters at both ends
Garbled output (replacement characters) Decode succeeds but text is mangled Terminal wrapping injected line breaks into the copy Paste as a single line; copy from the origin system, not the terminal
Padding errors in strict decoders Segment length is not a multiple of 4 Base64url omits = padding; some strict base64 tools expect it Use a decoder that understands base64url, or pad to a multiple of 4 before decoding
"Token expired" warning Token decodes fine; the tool flags the exp claim The expiration timestamp is in the past — a validation state, not a decode failure Request a fresh token, or extend the lifetime of your test token

Malformed base64url

JWT segments use the base64url alphabet: A–Z, a–z, 0–9, -, and _ — never +, /, or =. If a pasted segment contains those characters, either the token was re-encoded with standard base64 somewhere along the way, or something edited it. The reliable fix is to go back to the source and copy the token verbatim; if you need to experiment, round-trip the segment through a base64 encoder and confirm the output matches character for character.

Missing dots, extra dots

The three-segment rule is absolute for JWS-signed tokens. Two segments usually mean an unsecured or truncated token; four usually mean a token got concatenated with another one, or a copy boundary included a neighboring string. Count the dots before anything else — it takes one second and rules out half the possibilities.

Whitespace and line breaks

Copy-paste pipelines love to insert newlines: terminals wrap long lines, chat clients reflow text, log viewers add indentation. A decoder that receives eyJhbGci...\n.ldKH... will fail on the newline even though the token itself is perfect. Strip all whitespace before decoding — or paste from the original source rather than an intermediate view.

Expired tokens are not decode errors

It is worth internalizing the distinction: decoding is mechanical, validation is policy. An expired token decodes perfectly — its header, payload, and signature are all intact — but servers reject it with a 401 because exp is earlier than the current time. When your tool warns "token expired", the correct next step is to request a fresh token through your refresh flow, then compare the new token's iat and exp against the old one to confirm the lifetime your auth server actually grants. If you want to see the failure state deliberately, change the sample token's exp to a past timestamp such as 1792540800 (October 21, 2026, 00:00:00 UTC) and watch the claim check flip.

Safe Token Handling: Decoding Without Leaking Secrets

Because JWTs are readable and replayable, the way you decode them matters as much as what you learn from them. These are the rules we follow — and recommend — whenever a token needs to be inspected.

The five golden rules

  • Never paste production tokens into tools you do not control. This applies even to client-side decoders: the moment a live token touches a shared screen, a chat message, or a support ticket, it is a credential at risk until it expires.
  • Use dedicated test tokens for learning and demos. Like the sample above: fictional issuer, fake subject, throwaway secret. Build a small library of them for screenshots and workshops.
  • Redact before sharing. If you must discuss a real token, replace sensitive claim values — emails, user IDs, tenant names — while keeping the structure intact.
  • Prefer short-lived tokens. Current OAuth 2.1 draft guidance favors short-lived access tokens precisely because leaked credentials have a shrinking window of usefulness. A 15-minute token is a far smaller incident than a 30-day one.
  • Remember that decoding is not verification. A clean decode tells you what a token says. Only signature verification — with the key, in your backend — tells you what it is.

Building safe test tokens

Stock your test kit deliberately. Give every test token a unique jti from the UUID generator, sign it with a meaningless secret generated by the random string generator, and keep the subject values fictional. For secrets that lean toward password-like entropy, the password generator produces long random strings suitable for HS256 test keys. None of these values protect anything real — and that is the point: they are safe to paste anywhere, including public tools.

What "client-side" actually means

A client-side decoder performs the base64url decoding in JavaScript inside your browser tab, so the token is never uploaded to a server. That removes one class of risk — server-side logging and storage — but it does not make a production token "safe to share". The token itself remains a bearer credential; screenshots, pair-programming sessions, and browser history all extend its exposure. Client-side processing is a baseline we consider essential, not a license to be careless. The same judgment applies to credential hygiene overall — our password security guide and the practical rules in how to choose a strong password cover the mindset in depth.

From Decoding to Verification: A Practical Testing Workflow

Decoding is where debugging starts, not where it ends. Here is the workflow we recommend wiring into any project that issues JWTs.

A four-step workflow

  1. Decode. Paste the token into the JWT decoder and confirm structure and expected claims — algorithm, issuer, audience, timestamps.
  2. Validate claims. In your application's tests, assert that iss and aud match configuration, and that expired and future-dated (nbf) tokens are rejected.
  3. Verify the signature. With the real key, in your backend or API client — never in a public tool.
  4. Automate. Add test cases for expired tokens, wrong signing keys, and unexpected alg values so regressions surface in CI, not in production.

The developer's toolbox

Token building blocks

Adjacent security checks

Where this fits in the security stack

Keep the layers separate in your head. Login credentials are verified against password hashes — the advanced strategies in password hash generators explain why bcrypt and Argon2 dominate there. Session proof then travels as a signed JWT. And the whole exchange depends on transport security, which is why a periodic audit with the checklist in SSL & Whois website security auditing is worth calendar time. For breadth across all of these, the password generator security guide and the pillar free security tools guide map the landscape, while our developer tools guide and the developer tools hub cover the non-security utilities that round out a workflow.

Frequently Asked Questions

Treat every token as a secret. Even a decoder that runs entirely in your browser is a risk if the token is real, because a JWT is a bearer credential: anyone who copies it can replay it until it expires. The safe habit is to decode dedicated test tokens, or redact sensitive claim values before pasting anything from a real system.

Base64url encoding converts bytes into URL-safe text but provides no confidentiality. Anyone holding the token can decode the header and payload without a key. Encryption would require a key to reverse. That is why passwords, API keys, and personal data never belong in a JWT payload.

The usual causes are a truncated copy, extra or missing dots, whitespace or line breaks introduced when copying from a terminal, and characters that are not valid base64url, such as + or /. Expired tokens still decode fine; expiration is a validation problem, not a decoding problem.

Decoding still works: the header, payload, and signature remain fully readable. The token fails validation because the exp timestamp is earlier than the current time, so servers reject it with a 401 response. Request a fresh token and compare the new iat and exp values with the old ones to confirm the lifetime you expect.

HS256 signs and verifies with the same shared secret, which is simple but means every verifier could also mint tokens. RS256 signs with a private key and verifies with a public key, which fits distributed systems where only the issuer should sign. Check the alg field in the decoded header to see which one your token uses.

Ready to Decode Your First Token?

Copy the sample token above and open the client-side JWT decoder — header, payload, and signature split apart in one paste, with nothing sent to any server.

Open the JWT Decoder

Free Security Tools Guide

The pillar hub: password, JWT, hashing, and website security tools in one complete guide.

JWT Basics for Beginners

New to JSON Web Tokens? Start with structure, claims, and your first safe decodes.

Advanced JWT Hardening

Signature verification, algorithm pitfalls, key rotation, and server-side defenses.

Password Generator Security Guide

Build unguessable passwords and understand entropy, managers, and reuse risks.

How to Choose a Strong Password

Practical rules for length, passphrases, and avoiding predictable patterns.

Password Security Guide

Hashing, salting, breach checks, and the anatomy of safe credential storage.

Password Hash Generators: Advanced Strategies

bcrypt, Argon2, and PBKDF2 compared for developers securing stored credentials.

SSL & Whois: Website Security Auditing

Audit certificates, headers, and domain records around your token infrastructure.