Developer
JWT Explained: What a JSON Web Token Actually Is
JSON Web Tokens (JWTs) sit behind most modern authentication flows — you have likely held one in your browser's storage without ever seeing it. This guide explains the three parts of a JWT, what they are for, and the security rule that trips up even experienced developers: decoding a JWT does not verify it.
The three parts
A JWT is a string with three base64url-encoded segments separated by dots:
header.payload.signature
- Header — metadata about the token: the signing algorithm (typically
HS256orRS256) and the token type. - Payload — the claims: statements about the user and the token itself. Standard claims include
sub(subject, the user identifier),exp(expiration timestamp),iat(issued at), andiss(issuer). Applications add custom claims too. - Signature — a cryptographic value computed over the header and payload using a secret key (HMAC) or a private key (RSA/ECDSA). This is what lets a server detect tampering.
Encoding is not encryption
Base64url encoding is not encryption — it is a reversible text encoding. Anyone can decode the header and payload of any JWT and read its contents. Sensitive data should never be placed in a JWT payload expecting it to be hidden; the token's protection comes from the signature, which prevents modification, not reading.
Decoding versus verifying
Here is the critical distinction:
- Decoding — base64url-decoding the segments to read the claims. Anyone can do this with any JWT, no key required.
- Verifying — recomputing the signature with the expected key and checking it matches, plus checking claims like
expandiss. Only the server with the key can do this properly.
A decoder that shows you the payload is telling you what the token says, not that the token is valid. An attacker can craft a JWT with a forged payload; it will decode fine and fail verification. Never trust a token's contents based on decoding alone.
Security guidance
- Never paste production tokens into a server-side online decoder — the token may contain session data and the site may log it
- Prefer local decoding: a browser-based decoder like JWT Decoder processes the token entirely on your device
- Treat expired tokens as invalid — check
expagainst the current time during verification - Use strong algorithms: prefer asymmetric
RS256over shared-secretHS256for multi-service systems - Keep payloads small and free of sensitive personal data
When to use JWT
JWTs shine for stateless authentication: the server validates the signature and trusts the claims without storing session state. They are a poor choice for storing sensitive data (they are readable), for long-lived sessions (rotation and revocation are awkward), and for anything where you cannot protect the signing key. For most client-side debugging — checking what a token claims, why a request is failing, whether a claim name is correct — a local JWT decoder is all you need, with your data staying on your machine.
Related developer tools
JSON Formatter
Format, validate, and inspect JSON instantly. Essential for debugging API responses and configuration files.
Regex Generator
Generate a ready-to-use regex for common cases such as email or URL matching.
SQL Formatter
Format and beautify raw SQL queries for better readability and debugging.
JWT Decoder
Decode JSON Web Tokens and inspect the header and payload contents.
YAML Validator
Run a basic indentation check on your YAML and flag obvious spacing issues.
Markdown Preview
Preview how your Markdown content will render as HTML with live conversion.
More developer guides
JSON Formatting and Validation: A Developer's Guide to Clean Data
Master JSON formatting, validation, and debugging with practical examples and best practices.
Regex Tutorial: Patterns for Real-World Matching
A beginner-friendly guide to regular expressions — literals, character classes, quantifiers, groups, and the mistakes to avoid.
SQL Formatting Best Practices: Readable Queries That Scale
Consistent indentation, capitalized keywords, clear aliases — the formatting habits that make SQL maintainable.
YAML Guide: Syntax, Common Errors, and When to Use It
Indentation, mappings, arrays, and the YAML gotchas that break config files — plus how YAML compares to JSON.
Markdown Cheat Sheet: Everything You Need to Write Better Docs
Headers, lists, tables, code blocks, and links — the only Markdown guide you will need for READMEs and docs.
Why Browser-Based Tools Are the Safest Way to Handle Sensitive Documents
Discover why processing files in your browser protects privacy better than desktop or cloud alternatives.
Was this guide helpful?
Browse more tools and guides to get your work done faster — all in your browser, no account needed.
Explore all tools