JWT Decoded Shows "signature invalid" / Verification Failed — Is That Normal?
Symptom: decoder says "signature invalid"
You paste a JWT (JSON Web Token) into a decoder to inspect its payload, and the tool reports:
signature invalid
or flags it red as "verification failed". You wonder: is the token broken? Did I copy it wrong?
Short answer: the token is probably fine. The message says "verification failed", not "decoding failed".
Decode vs verify — know the difference
This is the key:
| Action | Needs secret? | What it does | Can it fail? |
|---|---|---|---|
| Decode | ❌ No | Base64URL-restores the three parts (header.payload.signature) into plain JSON | Almost never (unless malformed) |
| Verify | ✅ Yes | Recomputes the signature with the secret and compares it, confirming integrity | Fails on key/algorithm mismatch |
Decoding is "open the envelope and read" — anyone can do it. Verifying is "check the wax seal" — it requires the correct secret.
Why "signature invalid" appears
The tool decoded and tried to verify, and verification failed. Common reasons:
- Only part of the token was pasted — missing the last segment, or extra spaces/newlines;
- Algorithm mismatch — header says
HS256but the secret you supplied is forRS256(asymmetric), or vice versa; - Wrong secret — the verification key is not the one the issuer used;
- Tampered token — the payload was altered, so the signature no longer matches.
In essence:
signature invalidis the security mechanism working correctly — it tells you "I cannot confirm this token's integrity", not "the token cannot be read".
How to read the payload without verifying
If you only want to debug / inspect what fields the payload carries (e.g. check exp expiry, sub user id), you do not need verification. Open the JWT Decoder on ToolVault:
- Paste the full token into the input;
- The tool shows the plain JSON of header and payload, directly readable;
- It also shows verification status, but even if verification fails, the content is still visible — exactly what you need for debugging;
- Parsed locally, the token is never uploaded.
When you actually need verification
Only these scenarios require verifying with the correct secret:
- A backend receiving a request must confirm the token was issued by a trusted party and not tampered with;
- Deciding token expiry / validity, relying on
exp,nbf, etc.; - Security auditing to validate token origin.
Front-end "just reading" is debugging — never substitute "decode succeeded" for "verify passed" as an authorization check, or forged tokens will bypass you.
The five-root diagnosis tree
When signature verification fails, walk these in order — they cover nearly every case. (1) Secret mismatch: the signer and verifier hold different secrets — same key rotated on one side only, or dev/staging keys crossed. (2) Algorithm mismatch: signed RS256, verified HS256 (or the verifier trusts the header's alg). (3) Encoding mismatch: the base64url signature was transported through a system that re-encoded it as standard base64 (+/ instead of -_, padding added). (4) Signing input mismatch: the verifier signed header.payload with a subtle difference — reordered JSON keys, an extra newline, URL-decoding applied to the payload before verification. (5) Truncation: proxies or log pipelines clip long tokens. Each root has a 30-second test: compare base64url-decoded signature lengths, dump the exact signing input bytes on both sides, verify the alg header equals the verifier's expectation.
Debugging without leaking secrets
Never paste a production signing secret into an online verifier — that is the fastest way to turn a debugging session into an incident. The safe workflow: create a throwaway token signed with a test secret, reproduce the failure with it, debug that. If production tokens must be inspected, decode the header and payload (no secret needed) to rule out roots 2-5 first — the payload is base64url JSON, readable by design; only the signature requires the key. Our JWT decoder verifies HS256 signatures locally in the browser: the token and even the test secret never leave the page, which is the right trust boundary for debugging.
When "invalid" is actually "expired"
A surprising share of reported signature failures are exp/nbf checks in disguise — some libraries fold all token-validation errors into one message. Check the exp claim in the decoded payload before touching signature logic: if the token expired an hour ago, no amount of key archaeology will help. Pair this with the clock-skew notes in JWT exp/nbf troubleshooting.
Paste hygiene and what this decoder actually verifies
Before blaming the issuer, clean the paste: strip a leading Bearer , drop newlines from log lines, and confirm three dot-separated segments. ToolVault's JWT decoder now normalizes those paste accidents automatically, rejects an empty verify secret with an explicit message (instead of a vague "invalid"), and local HMAC verify covers HS256 / HS384 / HS512 only. An alg: RS256 (or ES256) token will decode fine and then refuse verify — that is not a broken token; the page is telling you it has no public key / JWKS path. Mint a throwaway HS256 token with a known test secret when you need a green checkmark.
kid / JWKS rotation vs "wrong secret"
Asymmetric stacks fail verification after key rotation when the verifier still holds the previous JWKS, caches kid → key aggressively, or ignores the kid header entirely. That looks identical to "wrong secret" in HMAC land. Decode the header first: if kid changed and your cache did not, refresh JWKS before rotating secrets again. Symmetric services have the twin failure: one pod still on the old HMAC secret after a rolling deploy.
FAQ
Can a token that fails verification still be used?
For inspection/debugging, yes. But any step that relies on the token for identity must verify it first. A token that fails verification should be rejected outright in business logic.
Why do some tools not show "invalid" while others do?
It depends on design. A decode-only tool won't complain; a decode+verify tool reports invalid when the secret is missing or mismatched. The content both show is identical.
Can HS256 and RS256 keys be mixed?
No. HS256 signs and verifies with the same symmetric secret; RS256 signs with a private key and verifies with a public key. Mixing them always fails verification.
Implementation notes
Troubleshooting a failed signature usually means shuttling the token between tools, so the decoder keeps a /en/tools/jwt-decoder?token=... deep link that tools like api-tester pass along when jumping over. The parameter is read only at mount; a token you paste in afterwards is never overwritten by the stale value in the URL.
Provided by ToolVault. Related tools: JWT Decoder, JWT Generator, Base64 Encode/Decode. Visit the home page for more developer tools.
Related Tools
Related Articles
Test Data Compliance Boundary: Why Copying Real User Data Into Test Environments Is Already Illegal
Using real user data in test environments violates purpose limitation under PIPL and GDPR: testing is a brand-new processing purpose. The four legal alternatives (anonymization/synthetic/public test ranges/hand-made), how format-valid-but-random works (national checksum standards), and the red-line list. With checksum algorithm tables for CN IDs, phones, and credit codes.
PIPL PIA Self-Check: The Five Triggering Scenarios, Three Assessment Elements, and a Working Framework
China's Personal Information Protection Law (Articles 55-56) requires a prior Personal Information Protection Impact Assessment (PIA) for five categories of processing. This post covers the triggers, the statutory three-element report structure, the three-year retention requirement, and a data-map → risk-matrix → controls framework. With the MLPS/miping/PIA three-pillar relationship.
MLPS 2.0 (China's Cybersecurity Multi-Level Protection Scheme) Self-Check: GB/T 22239, Layer by Layer
A practical self-check framework before China's MLPS level-protection evaluation (dengbao ceping): the filing workflow, high-frequency items across the five technical and five management layers, level-2 vs. level-3 differences, how MLPS relates to the cryptographic assessment (miping), and a remediation order ranked by points-per-effort.