Glyph WidgetsGlyph Widgets
AboutContactBlogPrivacyTermsSupport on Ko-fi

© 2026 Glyph Widgets. All rights reserved.

·

100% Client-Side Processing

Back to Blog

JWT Encoder/Decoder: Debug JSON Tokens

JWT encoder, decoder, and security auditor supporting HS256, RS256, ES256, PS256, and more. Inspect claims, verify signatures, and audit.

Glyph Widgets
February 27, 2026
12 min read
jwt encoderjwt decoderjwt generatorjwt onlinejson web token encoder

What Is the JWT Encoder/Decoder?

The JWT Encoder/Decoder creates signed JSON Web Tokens, decodes existing tokens to reveal their contents, and runs automated security audits against a token's claims and algorithm choices. JSON Web Tokens are the most common format for stateless authentication — an API gateway, OAuth provider, or microservice generates a signed token, and downstream services verify that signature rather than querying a central session store. When something goes wrong (a token is rejected, a claim has an unexpected value, or you need to verify your signing logic), you need to inspect the token without writing custom code. This tool handles encoding with 13 algorithms across four families, decoding with live expiration status, signature verification, and a security audit mode that checks for common vulnerabilities. All operations run client-side — your tokens and signing keys never leave the browser.

> Try it now: JWT Encoder/Decoder — free, no signup, 100% client-side.

Key Features

  • Create signed JWTs with HMAC (HS256/384/512) — enter a JSON payload and a shared secret; the tool signs the token using the jose library's SignJWT API.
  • Support for RSA (RS256/384/512), ECDSA (ES256/384/512), and RSA-PSS (PS256/384/512) — paste a PEM-encoded private key for asymmetric signing; the tool imports the key using importPKCS8 and signs accordingly.
  • Unsigned tokens with alg: none — creating unsigned tokens is supported but clearly flagged with a red warning panel.
  • Quick-add standard claims — one-click buttons insert iss, sub, aud, exp (+1 hour), exp (+1 day), iat, nbf, and jti (a random UUID from crypto.randomUUID()) into the payload editor.
  • Decode JWT header and payload — pasting any JWT immediately shows the parsed header and payload as formatted JSON in side-by-side panels, with the algorithm and type shown below the header.
  • Check expiration status — a colored status banner shows whether the token is expired or valid, with a live countdown (e.g., "2h 34m remaining" or the expiry date and time).
  • Verify signatures — provide the secret (HMAC) or PEM public key (asymmetric) and the tool calls jwtVerify to confirm the signature is cryptographically valid.
  • Color-coded JWT output — the three token segments are displayed in red (header), purple (payload), and blue (signature) for easy visual identification.
  • Security Audit mode — analyzes a token for 10 distinct security issues including alg: none, missing exp, expired tokens, nbf in the future, very long expiration, weak algorithms, and missing iss, aud, sub claims.
  • Batch mode — decodes multiple JWT tokens at once (one per line), outputting the algorithm and payload summary for each.
  • 100% client-side processing — uses the jose npm package running entirely in-browser; no tokens or keys are transmitted.

How to Use the JWT Encoder/Decoder

Step 1: Select a Mode

Three mode buttons appear at the top of the tool: Encode, Decode, and Security Audit. A yellow security notice below the mode selector reminds you that signing keys should not be entered into tools you do not trust — this is good practice to read before proceeding with any key material.

Step 2: Create a JWT (Encode Mode)

Choose an algorithm. A grouped dropdown presents the 13 supported algorithms organized by family: HMAC Symmetric (HS256, HS384, HS512), RSA Asymmetric (RS256, RS384, RS512), ECDSA Asymmetric (ES256, ES384, ES512), RSA-PSS Asymmetric (PS256, PS384, PS512), and Unsigned (none). The default is HS256.

Edit the payload. A JSON editor pre-fills with a sample payload containing sub, name, and iat (set to the current Unix timestamp at page load). Edit this directly. Use the Quick-Add Claims buttons to insert standard claims without typing timestamps manually — clicking + exp (+1h) inserts an exp value set to the current Unix timestamp plus 3600 seconds.

Enter the signing key. For HMAC algorithms (HS256/384/512), a password-type input field accepts the shared secret. A show/hide toggle reveals the value. For asymmetric algorithms, a multiline textarea accepts a PEM-formatted private key beginning with -----BEGIN PRIVATE KEY-----.

Click "Encode JWT". The signed token appears in a color-coded output panel. A "Copy" button copies the full token. A "Decode this token" button transfers it to the Decode tab for immediate inspection.

Step 3: Decode a JWT (Decode Mode)

Paste any JWT into the token input field. Decoding is immediate — no button click required. The tool splits the token on ., Base64URL-decodes each segment using a custom base64UrlDecode function, and JSON-parses the header and payload.

If the token has an exp claim, a colored banner appears above the decoded panels:

  • Green with a checkmark: "Token Valid — 2h 34m remaining"
  • Red with a warning icon: "Token Expired — Expired on [date/time]"

The header and payload appear in side-by-side formatted JSON panels, each with a copy button. Below them, a Claims Details panel renders every payload claim in its own card. Timestamp claims (exp, iat, nbf) show both the raw Unix integer and the human-readable date string.

The Signature & Verification section displays the raw signature string and provides a key input for verification. Enter the secret or public key and click "Verify Signature". The result card turns green for a valid signature or red for an invalid one.

Step 4: Run a Security Audit (Audit Mode)

Switch to the Security Audit tab and paste a token. Findings appear immediately as the token is parsed. Each finding card shows a severity badge (CRITICAL, WARNING, NOTE, or INFO), a title, a plain-English description, and a specific recommendation. The audit checks 10 conditions:

  1. alg: none or missing — CRITICAL
  2. Weak algorithm HS1 — WARNING
  3. Symmetric algorithm in use — NOTE
  4. Missing exp claim — WARNING
  5. Token already expired — CRITICAL
  6. Expiry more than one year in the future — NOTE
  7. nbf claim is in the future — WARNING
  8. Missing iss claim — INFO
  9. Missing aud claim — INFO
  10. Missing sub claim — INFO

If no issues are found, an INFO card reads "No major issues found — continue to validate tokens server-side and keep signing keys secret."

Practical Examples

Generating a Test Token for an API

Your backend expects a HS256-signed JWT with sub, iss, aud, and exp claims. In Encode mode, select HS256, start with the default payload, then click + iss, + sub, + aud, and + exp (+1h) in sequence to build the full payload. Enter your test secret and click Encode. Copy the resulting token into your API testing tool or HTTP header. When the test fails, paste the token into Decode mode to verify the claims match expectations — the Claims Details panel makes it easy to confirm each value without manually Base64-decoding.

Debugging a "Token Expired" API Error

Your application is getting 401 Unauthorized responses. Paste the token from your application's Authorization header into Decode mode. The expiration banner immediately tells you whether the token has expired and when. If it expired three minutes ago, the issue is either a short-lived token without refresh logic, or a clock skew between your client and the token issuer. The iat and exp claims in the Claims Details panel show the issue window in human-readable dates.

Auditing Tokens Before a Security Review

Before a code review or penetration test, paste production JWT samples into Security Audit mode to identify easy wins. A token that comes back with CRITICAL findings for alg: none or missing exp needs immediate attention. A NOTE about a symmetric algorithm in a multi-service architecture is worth discussing during the review. The audit output can be copied and pasted directly into a security findings document.

Tips and Best Practices

Use asymmetric algorithms (RS256, ES256) for public APIs. HMAC (HS256) algorithms use a shared secret: any service that can verify a token can also create one. With RS256 or ES256, only the private key holder can sign new tokens, while any service can verify them using the distributed public key. The Security Audit mode flags HS algorithms with a NOTE for this reason.

Always set an exp claim. A token without expiration remains valid indefinitely unless explicitly revoked. The Quick-Add Claims section provides one-click buttons for 1-hour and 1-day expirations. Access tokens should expire within minutes to a few hours; use refresh tokens for longer sessions.

Use jti for one-time-use tokens. The + jti (UUID) quick-add button inserts a unique token identifier generated by crypto.randomUUID(). Server-side, you can store and check this value to prevent token replay attacks on password reset or email confirmation flows.

Do not use the none algorithm in production. The tool creates unsigned tokens when alg: none is selected but displays a red warning panel. The Security Audit mode rates alg: none as CRITICAL. This algorithm should only appear in test environments where token verification is intentionally disabled.

Common Issues and Troubleshooting

"Invalid JWT format. A JWT should have 3 parts separated by dots." — the string you pasted does not have exactly two . characters. Ensure you copied the full token including all three segments. JWTs with a trailing newline or space will also fail — whitespace at the edges is trimmed, but embedded whitespace will cause this error.

"Invalid Base64 encoding" — one of the token's segments is not valid Base64URL. This can happen if the token was truncated during copy-paste, or if the string is a different encoded format (such as an opaque reference token from OAuth that is not a JWT at all).

"Secret required" / "Private key required" — you clicked Encode without filling in the signing key field. HMAC algorithms require a non-empty secret; asymmetric algorithms require a PEM private key.

"Invalid JSON payload" — the payload editor contains malformed JSON. Check for trailing commas, unquoted keys, or single-quoted strings. The Quick-Add Claims buttons always produce valid JSON, so if you edited the payload manually, look for syntax errors.

Verification returns invalid even with the correct key — ensure you are using the same algorithm the token was signed with (shown in the header's alg field, which the Decode mode displays automatically). For asymmetric verification, ensure you are providing the public key, not the private key.

alg: none token shows "Cannot verify" on verification — unsigned tokens have no signature to verify. The tool returns a specific "unsupported" status for this case and disables the Verify button when alg is none.

Privacy and Security

The JWT Encoder/Decoder processes all tokens and keys locally using the jose library running in your browser. No JWT, secret, or private key is transmitted to any server. The tool makes no network requests during encoding, decoding, or verification. The yellow security notice displayed in the tool is genuine: treat any online tool as untrusted for production signing keys. For development and debugging with non-production credentials, this tool is safe to use. Verify the behavior yourself by opening browser DevTools and checking the Network tab — you will see no outbound requests during any operation.

Frequently Asked Questions

Is the JWT tool free to use? Yes. The tool is completely free with no account or signup required.

Can I use it offline? Yes. After the page has loaded, all encoding, decoding, and auditing runs locally. No network request is made for any JWT operation.

Are my tokens and signing keys safe? The tool makes no network requests during operation. Your tokens and keys remain in your browser tab. That said, avoid entering production private keys into any browser-based tool. Use test keys or non-production credentials.

Which algorithms are supported? The tool supports 13 algorithms: HS256, HS384, HS512 (HMAC), RS256, RS384, RS512 (RSA PKCS#1), ES256, ES384, ES512 (ECDSA), PS256, PS384, PS512 (RSA-PSS), and none (unsigned). The jose library handles the cryptographic operations.

Can it verify a signature without the original secret? No. Signature verification requires the signing secret (HMAC) or the corresponding public key (asymmetric). Decoding — reading the header and payload — does not require any key and works immediately.

What format does the private key need to be in? Asymmetric signing requires a PKCS#8 PEM-formatted private key (beginning with -----BEGIN PRIVATE KEY-----). The jose library's importPKCS8 function handles the import. PKCS#1 format (beginning with -----BEGIN RSA PRIVATE KEY-----) is not supported; convert using openssl pkcs8 -topk8 -nocrypt.

What is the difference between Decode mode and Security Audit mode? Decode mode shows the token's contents — header, payload, claims, and expiration status — and lets you verify the signature. Security Audit mode focuses solely on identifying security weaknesses in the token's design: missing claims, weak algorithms, expired tokens, and configuration issues. Both modes require no signing key.

Why does the Security Audit flag my HS256 token? The audit notes (severity NOTE, not WARNING or CRITICAL) that HMAC algorithms use a shared secret, meaning any service with the secret can both verify and create tokens. This is an architectural consideration for multi-service systems, not a bug in your token. The note recommends asymmetric algorithms for systems where only one service should be able to issue tokens.

Can I decode a JWT without knowing the algorithm? Yes. The algorithm used to sign the token is stored in the header's alg field. Decoding reads the header first, which reveals the algorithm. You only need to know the algorithm (and have the key) if you want to verify the signature.

How does Batch Mode work? Enable Batch Mode with the toggle button, then enter one JWT per line. Click "Process All" to decode every token. The output table shows each token's algorithm (from the header) and its full payload as a JSON string. Malformed tokens show an error in the output column.

Related Tools

The Base64 Encoder/Decoder handles the URL-safe Base64 encoding used inside JWT segments. The JSON Formatter is useful for formatting the decoded payload JSON when you want to explore nested structures. The Password Generator can generate strong random secrets for use as HMAC signing keys.

Try JWT Encoder/Decoder now: JWT Encoder/Decoder

Last updated: February 27, 2026

Keep Reading

More ArticlesTry JWT Encoder/Decoder