Toolsky

Free Online Tools & Utilities for Every Task.

JWT Encoder / Decoder

Easily decode, verify, and encode JSON Web Tokens (JWT) directly from your browser.

Encoded Token
Verify Signature
Used to recalculate and verify the hash.
Decoded Data Status

HEADER: ALGORITHM & TOKEN TYPE

PAYLOAD: DATA

A JWT encoder and decoder lets you look inside a JSON Web Token, check its signature, and build tokens of your own. JWTs are the little three-part strings that APIs hand out after login and expect back on every request — compact, URL-safe, and completely opaque to the naked eye. This tool works directly in your browser: paste a token and see its header and payload as readable JSON, verify whether its signature is genuine, or encode a token from a payload and a secret when you are developing or testing an authentication flow.

What a JSON Web Token Actually Contains

The format, standardised in RFC 7519, joins three Base64URL-encoded pieces with dots. The header is a small JSON object naming the signing algorithm and the token type — typically {"alg":"HS256","typ":"JWT"}. The payload holds the claims: statements about a user and the token itself, such as sub (who the token belongs to), name, iat (when it was issued), and exp (when it expires). The signature is a cryptographic checksum over the first two parts, produced with a secret key (for HMAC algorithms like HS256) or a private key (for RSA/ECDSA algorithms like RS256 and ES256). Anyone can decode the first two parts — signing is not encryption — but only the holder of the key can produce a signature that verifies, which is what makes a tampered token detectable.

What This JWT Tool Does

  • Decode: splits a token into its three parts and shows the header and payload as formatted JSON, turning an opaque string into claims you can read.
  • Verify: for HMAC-signed tokens, supply the secret and the tool recomputes the signature, telling you whether the token is authentic and untouched.
  • Encode: build a signed token from your own header, payload, and secret — the everyday need when testing an API that expects JWT authentication.
  • Browser-based: decoding, verifying, and encoding happen right in your browser session, which is where quick token inspection belongs during development.

How to Decode and Verify a JWT Step by Step

  1. Copy the complete token from your API response, request header, or storage — all three dot-separated parts.
  2. Paste it into the tool's token field; the header and payload decode automatically into readable JSON.
  3. Read the claims: check sub, the expiry (exp) and issued-at (iat) timestamps, and any roles or scopes your API relies on.
  4. To verify, enter the secret the token was signed with (for HS256) and run the verification.
  5. Read the result: a valid signature means the token was issued by whoever holds the secret and has not been altered since.
  6. To encode instead, write your header and payload JSON, choose the algorithm, supply a secret, and generate the token.

A Worked Example: Reading a Real Token's Claims

The most widely reproduced sample token in documentation decodes as follows. Its header is {"alg":"HS256","typ":"JWT"} — HMAC with SHA-256, a JSON Web Token. Its payload is {"sub":"1234567890","name":"John Doe","iat":1516239022}: the subject is user 1234567890, the name claim is John Doe, and the token was issued at Unix time 1516239022, which is a date in January 2018. Note what is absent: no exp claim, so by its own contents this sample never expires — one reason it is a teaching example rather than a production credential. Decoding took no key and no permission, because that is how JWTs are designed: readability is public, and all the trust lives in the signature. When you decode your own API's tokens, the same reading skill applies — find exp first to answer "why did my request suddenly fail with 401?", because an expired token is the most common cause.

Where Developers Use This Day to Day

Debugging authentication is the headline use: a request fails, and the decoded payload reveals an expired exp, a wrong audience, or a missing role claim in seconds. API developers encode test tokens with known secrets to exercise endpoints without standing up a full login flow. Support engineers decode a customer's token (with the customer providing it knowingly) to confirm which account and permissions a session actually carries. Students of web security use decoding to internalise the central lesson of JWT design — that a token's contents are visible to its bearer — which explains real-world incidents where sensitive data was placed in payloads. If your API work also involves the encoding underneath, the Text to Base64 converter shows the family resemblance, and the Hash Generator covers the standalone hashing side of the same territory.

Limitations and Security Mistakes to Avoid

Three warnings matter. First, decoded does not mean trustworthy: only a verified signature earns trust, and a token with "alg":"none" or a payload you have not verified is just a claim someone typed. Second, verification needs the right key — an HS256 token verifies only against the exact secret that signed it, and asymmetric tokens need the public key; the tool cannot conjure either. Third, hygiene: a live production token is a credential, so treat pasting one anywhere the way you would treat pasting a password — this tool runs in your browser, but the habit of care should be automatic, and tokens copied into bug reports or chats should be revoked or allowed to expire. On the encoding side, never invent your own expiry policy casually: short-lived tokens with sensible exp claims are the ecosystem's hard-won default.

Frequently Asked Questions About the JWT Encoder and Decoder

Can anyone decode my JWT without the secret?

Yes — by design. Header and payload are Base64URL-encoded, not encrypted, so anyone holding the token can read its claims. The secret protects the signature, which is what stops tampering, not reading.

What does signature verification actually prove?

That the token was signed by whoever holds the secret or private key, and that header and payload have not changed since. A failed verification means the token was altered, corrupted, or signed with a different key.

Why does my token show as expired when the times look close?

Expiry is judged against the exp claim in Unix seconds. A token past its exp is expired even by a minute, and clock differences between servers can make borderline tokens fail — decode and read exp numerically rather than guessing.

What is the difference between HS256 and RS256?

HS256 uses one shared secret to sign and verify (HMAC). RS256 uses a private key to sign and a public key to verify (RSA), which suits systems where many services must verify tokens but only one may issue them.

Can I decode a token with only two parts?

An unsigned token sometimes appears with an empty signature part, but a standard JWT has three parts. Two segments usually means a truncated paste — copy the token again in full.

Is it safe to put sensitive data in a JWT payload?

No. Because anyone can decode it, payloads should carry identifiers and permissions, not passwords, personal details, or secrets. Treat every claim as if it were printed on the outside of an envelope.

What does the iat claim tell me?

The issued-at time: when the token was created, in Unix seconds. Together with exp it defines the token's lifetime, and decoding both is the fastest way to understand a session's intended duration.

Trust Is in the Signature, Not the String

A JWT looks like gibberish and behaves like an open book stapled to a sealed certificate: the contents are there for anyone to read, and the signature is there for software to trust. Decoding, verifying, and encoding tokens fluently is a core API skill, and having the tooling in the browser — where the tokens already live — makes inspection a reflex instead of a chore.