DEV Community

Trần Xuân Ái
Trần Xuân Ái

Posted on

How to Decode JWT Tokens Without Sending Data to a Server

If you work with APIs, authentication, or frontend applications, you've probably seen a JWT token before.

JWTs are everywhere:

  • OAuth
  • Firebase
  • Supabase
  • NextAuth
  • Auth0
  • Clerk
  • custom backend authentication systems

But many developers still paste JWT tokens into random online JWT decoder websites without realizing the security implications.

In this article, we'll look at:

  • what a JWT token actually is
  • how JWT decoding works
  • common JWT debugging issues
  • how to decode JWT tokens locally in your browser
  • how to inspect JWT payloads safely

What Is a JWT Token?

JWT stands for JSON Web Token.

A JWT token is a compact string format commonly used for:

  • authentication
  • authorization
  • API sessions
  • identity verification

A typical JWT looks like this:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
.
eyJ1c2VySWQiOjEyMywiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIn0
.
abc123signature
Enter fullscreen mode Exit fullscreen mode


`

A JWT consists of 3 parts:

  1. Header
  2. Payload
  3. Signature

JWT Header

The JWT header contains metadata about the token.

Example:


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

Common JWT algorithms:

  • HS256
  • RS256
  • ES256

JWT Payload

The JWT payload contains claims.

Example:


{
"userId": 123,
"email": "test@example.com",
"role": "admin"
}

Common JWT claims:

  • sub
  • exp
  • iat
  • aud
  • iss

This is usually the part developers want to inspect when debugging authentication issues.


JWT Signature

The JWT signature is used to verify integrity.

It prevents attackers from modifying the token payload.

Important:
Decoding a JWT does NOT mean verifying it.

Many developers confuse:

  • JWT decode
  • JWT verify

These are different operations.


Why Developers Need a JWT Decoder

A JWT decoder is useful for:

  • debugging expired tokens
  • inspecting payload claims
  • checking user roles
  • validating OAuth flows
  • troubleshooting authentication bugs
  • inspecting API sessions

Typical frontend debugging workflow:


Login → receive token → decode JWT → inspect payload → debug auth issue


The Problem With Most JWT Decoder Websites

Many online JWT decoder tools:

  • upload your token to servers
  • inject ads
  • track requests
  • feel slow
  • expose sensitive data

This is risky because JWT payloads sometimes contain:

  • emails
  • user IDs
  • internal metadata
  • API scopes
  • authentication claims

Even though JWT payloads are Base64 encoded (not encrypted),
you still should avoid sending production tokens to random services.


How JWT Decoding Works

JWT decoding is actually simple.

The payload is Base64URL encoded JSON.

You can decode it locally without contacting any server.

The process:


JWT → split by "." → decode payload → parse JSON

Example:


const payload = token.split(".")[1];
const decoded = JSON.parse(atob(payload));
console.log(decoded);


Common JWT Errors

1. Invalid Signature

Usually caused by:

  • wrong secret
  • modified token
  • incorrect algorithm

2. JWT Expired

Check the exp claim:


{
"exp": 1750000000
}


3. Malformed JWT

A valid JWT must contain 3 sections:


header.payload.signature


4. Wrong Algorithm

Example:

  • backend uses RS256
  • frontend expects HS256

This breaks verification.


Decode JWT Tokens Locally in Your Browser

I got tired of using slow JWT decoder websites filled with ads,
so I built a simple browser-based JWT Decoder tool.

Features:

  • local JWT decoding
  • no server upload
  • instant parsing
  • formatted JSON output
  • JWT header inspection
  • payload inspection
  • signature validation support

Try it here:

https://fullconvert.cloud/jwt-decoder

You can also generate tokens here:

https://fullconvert.cloud/jwt-encoder


JWT Security Tips

Never store sensitive secrets inside JWT payloads.

JWT payloads are only encoded, not encrypted.

Avoid putting:

  • passwords
  • API secrets
  • private credentials

inside JWT claims.


Final Thoughts

JWT authentication is now part of almost every modern web application.

Understanding how JWT decoding works can save hours of debugging time.

Whether you're working with:

  • React
  • Next.js
  • Node.js
  • Express
  • Firebase
  • Supabase
  • Auth0

a good JWT decoder becomes essential in your daily developer workflow.

If you frequently debug authentication issues,
using a local browser-based JWT decoder is usually the safest and fastest option.

Top comments (0)