Home/Developer Tools/JWT Encoder & Decoder
🔑

JWT Encoder & Decoder

FREE

Decode a JWT's header and payload, or sign one with HS256

Free · No sign-up required
Loading...

What the JWT tool does

A JSON Web Token (JWT) is a compact string that carries a set of claims — typically who a user is and what they are allowed to do — with a signature that lets the receiver check the token has not been tampered with. This tool decodes any JWT to show its header and payload as readable JSON, and can also build a new token from a payload and a secret using HS256. Decoding needs no secret, because the payload is only Base64-encoded, not encrypted. Everything runs in your browser; tokens you paste are not sent anywhere, which matters because a live token is a credential.

The three parts of a token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 . eyJzdWIiOiIxMjM0IiwiZXhwIjoxNzUwMDAwMDAwfQ . SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c header . payload . signature
PartContentsEncoding
Header{"alg":"HS256","typ":"JWT"} — the signing algorithmBase64URL of JSON
PayloadClaims: sub, exp, iat, roles, and anything else the issuer addsBase64URL of JSON
SignatureHMAC or RSA/ECDSA signature over header.payloadBase64URL of raw bytes

Base64URL is ordinary Base64 with + and / replaced by - and _ and no padding, so the token is safe in URLs and headers.

Standard claims

ClaimMeaningNotes
issIssuerWho created the token
subSubjectUsually the user ID
audAudienceWhich service the token is for
expExpirationUnix timestamp; reject after this
nbfNot beforeUnix timestamp; reject before this
iatIssued atUnix timestamp
jtiJWT IDUnique ID for revocation lists

Timestamps are seconds since 1 January 1970 UTC. The decoder shows them as-is; 1750000000 is mid-June 2025. Any other keys (role, email, scope) are custom claims defined by the issuer.

Signing: HS256 vs RS256

  • HS256 (HMAC-SHA256) — one shared secret both signs and verifies. Simple, fast, fine when the same service issues and checks tokens. Anyone with the secret can mint tokens, so it must never be shipped to a client.
  • RS256 / ES256 (RSA / ECDSA) — a private key signs, a public key verifies. Used when many services verify tokens issued by one identity provider (Auth0, Cognito, Keycloak, Google). The public key is published at a JWKS URL.

This tool signs with HS256 only. Its encode mode is for building test tokens and understanding the format — use your framework's JWT library in production.

Security rules that are easy to get wrong

  • Decoding is not verifying. Anyone can read a JWT's payload. Trust the claims only after the signature has been checked with the right key and the exp claim is in the future.
  • Never put secrets in the payload. Passwords, card numbers and personal data are visible to anyone who sees the token. Use JWE (encrypted JWT) if confidentiality is required.
  • Reject alg: none and never let the token dictate the algorithm — a classic attack swaps RS256 for HS256 and uses the public key as the HMAC secret.
  • Keep tokens short-lived (minutes to an hour) and use refresh tokens for longer sessions. A JWT cannot be revoked once issued unless you keep a deny-list.
  • Use a strong secret for HS256 — at least 32 random bytes. Short secrets are brute-forced offline in seconds.

Common uses

  • Inspecting the access token an app received to see which scopes or roles it actually carries.
  • Debugging a 401 by checking whether exp has passed or aud does not match.
  • Building a test token with a known secret for a local API.
  • Reading ID tokens from OpenID Connect to see the user profile claims.

Frequently asked questions

Can this tool verify a token's signature?

For HS256, enter the secret and encode the same payload — if the output matches the original token, the signature is valid. RS256 verification is not supported here.

Is it safe to paste a production token?

The token stays in your browser, but treat any live token as a password: prefer expired or test tokens, and revoke a token if you have pasted it anywhere you do not fully trust.

Why does my payload show odd characters?

The payload contains non-ASCII text (names, emoji) and the issuer encoded it as UTF-8. The decoder handles UTF-8; if it still looks wrong, the token may be truncated.

What is the difference between a JWT and a session cookie?

A session cookie is an opaque ID looked up in server storage; a JWT carries the data itself and is verified by signature, so the server needs no lookup. JWTs scale across services more easily; sessions are easier to revoke.

Are JWTs encrypted?

Standard JWS tokens are signed, not encrypted — readable by anyone. JWE tokens are encrypted and look similar but have five parts instead of three.

Why is my token rejected even though it decodes fine?

Decoding only proves the format. Common rejection reasons: expired exp, wrong aud or iss, signature made with a different key, or clock skew between servers.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
📋
XML Tools
Beautify, validate and convert XML to JSON
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔐
URL & Base64 Encoder / Decoder
Percent-encode for URLs or convert to and from Base64