Struggling to debug a JWT token that won't work in your API? Don't feel like installing Postman just to see what's inside? Good news: you can do it in 30 seconds, right in your browser, without installing anything. Here is how.
What is a JWT anyway?
A JWT (JSON Web Token) is an authentication token that your backend generates when a user logs in. It's a long string that looks like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
What you don't notice at first glance is that this token is actually three parts separated by dots:
- Header (before the 1st dot): the algorithm used (
HS256,RS256, etc.) - Payload (between the 2 dots): the data (
user_id, email, expiration, etc.) - Signature (after the 2nd dot): the integrity proof
These three parts are simply Base64URL-encoded JSON. That's why we can decode them.
Why you need to decode it
Situations where you need to "look inside" a JWT:
- 🐛 Debug: "Why isn't my auth working?"
- 🔍 Check expiration: "When does my token expire?"
- 👀 View claims: "What fields is the backend sending me?"
- 🛡️ Audit: "Is there sensitive data I shouldn't be storing?"
How to decode a JWT in 30 seconds
Method 1: Using an online tool (the fastest way)
- Go to https://jchub.dev/fr/outils/decodeur-jwt
- Paste your token into the field
- The tool instantly shows you:
- The header in formatted JSON
- The payload with every claim detailed
- The signature (which can't be read, and that's normal)
- The status: valid or expired
- You can copy each part in one click
Benefit: you see everything, and you even get an "expired" or "valid" indicator with the exact expiration date.
Method 2: In the browser console
If you don't have time to open a tool, you can do it right in DevTools (F12):
// Paste this into the console
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";
const parts = token.split('.');
const decode = (str) => JSON.parse(atob(str.replace(/-/g, '+').replace(/_/g, '/')));
console.log('Header:', decode(parts[0]));
console.log('Payload:', decode(parts[1]));
This method works, but it doesn't give you:
- The expiration indicator
- Pretty JSON formatting
- Automatic validation
Method 3: From the command line (for pros)
On macOS or Linux:
echo "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." | cut -d'.' -f2 | base64 -d
On Windows (PowerShell):
$token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($token.Split('.')[1]))
Real-world example: debugging a 401 error
Imagine: you're building a Node.js API, you send a JWT in the Authorization header, but you get a 401 Unauthorized error.
Here is how to diagnose it:
- Grab your token (from localStorage, the network tab, or the backend)
- Paste it into the JWT decoder
- Check the payload — verify:
exp(expiration): if the date has passed → your token is dead, you need to request a new onesub(subject): is it the expected user ID?iss(issuer): is it your backend URL?aud(audience): is it your frontend?
- Check the algorithm in the header — if the backend expects
RS256but you're sendingHS256, it won't work
In 90% of cases, the exp has simply expired. The decoder will tell you at a glance.
What you should NOT do with a JWT
⚠️ Never put sensitive data in the payload (passwords, credit card numbers, etc.). Why? Because anyone can decode it — it's not encrypted, just encoded. Base64 is like a .zip file without a password.
For sensitive data, use an encrypted token (JWE) or keep it on the server side.
Conclusion
Decoding a JWT isn't rocket science. It's just Base64 + JSON. But having a tool that shows you all of that nicely formatted, with an expiration indicator, saves you 10 minutes of debugging every single time.
👉 Try it for free: https://jchub.dev/fr/outils/decodeur-jwt
You copy your token, you paste, you get your answer. That's it.
Want more free dev tools? JcHub offers 14 tools (JWT, hash, timestamp, regex, color, QR code, etc.). All free, all online, zero install. → Discover all tools
