8 min read
What is JWT and how to decode it
JWTs are common in authentication. Learn what the three sections mean and why decoding is not verification.
Table of contents
JWT structure
A JWT usually has three dot-separated sections: header, payload, and signature. The header describes metadata such as the algorithm and token type. The payload contains claims such as subject, issuer, audience, expiration, roles, or custom application data. The signature is used by the receiving system to verify that the token was issued by a trusted party and has not been changed.
The first two sections are Base64URL-encoded JSON. That means they are easy to decode into readable text. Encoding is not encryption. Anyone who has the token can usually read the header and payload.
What decoding does
Decoding turns the header and payload back into JSON so humans can inspect them. Developers decode JWTs when debugging authentication, checking scopes, investigating expiration, or confirming which user identifier appears in the token.
A decoder is useful for visibility, but it does not say whether the token should be accepted by an API. A malicious user can create a token with any payload. Without signature verification, those claims are just text.
What verification does
Verification checks the signature using the correct secret or public key. It also checks claims such as issuer, audience, expiration, not-before time, and sometimes authorized party or scope. This work belongs in backend or trusted application code.
If verification fails, the decoded payload should not be trusted. If verification succeeds, the application can use claims according to its authorization rules.
Safe JWT debugging
When debugging JWTs, avoid pasting live access tokens into public chats, screenshots, or tickets. Tokens may include user identifiers or grant access to APIs. If you need help, redact the signature and sensitive claims or use a test token.
Use a decoder to inspect structure, then use your application logs or backend verification flow to confirm trust. Decoding and verification answer different questions.
Related guides
What is JSON and why developers use it
A practical explanation of JSON, where it appears in development, and why its simple structure made it the common language of APIs.
How to format JSON online
Learn when to format JSON, how online formatters work, and what to check when formatting fails.
How to validate JSON and fix common errors
A practical guide to JSON validation, parser messages, and the most common syntax mistakes developers run into.
FAQ
What does JWT stand for?
JWT stands for JSON Web Token.
Is a JWT encrypted?
Most JWTs are encoded and signed, not encrypted. The header and payload are usually readable.
Does decoding verify a JWT?
No. Decoding only reads the header and payload. Verification checks the signature and claims.
Should I paste production tokens into tools?
Avoid sharing live tokens. Use redacted examples whenever possible.