JWT 解析器

在浏览器本地解码并格式化 JSON Web Token(JWT)的头部与载荷数据。接收 JWT 凭据字符串,解密 Base64Url 编码并直观呈现声明键值与时间戳。本工具仅执行纯前端解码与排版,不连网比对公钥或验证数字签名的防篡改有效性。

在排查接口授权时,如何离线解码 JWT 结构

适用于在排查接口认证、单点登录或权限问题时,离线查看 JSON Web Token(JWT)头部算法与载荷声明。工具在浏览器本地将标准紧凑格式(3 段由点分隔的 Base64URL 字符串)解码为可读的 JSON 结构。请注意:离线解码仅展示 Token 明文内容,并不验证数字签名,也不保证该 Token 真实有效或未被篡改。

操作步骤

  1. 在输入框中粘贴标准 3 段紧凑格式的 JWT 字符串(以点号 . 分隔 header、payload 与 signature)。切勿粘贴包含生产私钥或敏感密码的真实凭据。
  2. 查看右侧或下方的解码视图:检查 Header 中的签名算法(alg)与类型(typ),并核对 Payload 中的标准声明(如 sub、exp 过期时间、iat 签发时间及自定义业务角色)。
  3. 复制或下载格式化后的 Header 与 Payload JSON;结合服务端公钥或鉴权日志独立验证签名。

解码包含标准声明与开发角色的合成 JWT 样本

输入

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwibmFtZSI6IkFsaWNlIFNtaXRoIiwicm9sZSI6ImRldmVsb3BlciIsImlhdCI6MTcxMDAwMDAwMCwiZXhwIjoxNzEwMDAzNjAwfQ.bW9jay1zeW50aGV0aWMtc2lnbmF0dXJlLWJ5dGVz

选项

标准紧凑格式(3 段 Base64URL)

输出 / 解析结果

{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "user-42",
    "name": "Alice Smith",
    "role": "developer",
    "iat": 1710000000,
    "exp": 1710003600
  },
  "signatureVerified": false
}

限制与常见问题

  • 仅解码不等于验证:本工具仅进行 Base64URL 解析与 JSON 格式化,不持有服务端私钥,不会向远程鉴权服务器校验数字签名。显示合法 JSON 绝不代表 Token 是真实有效的、来自受信任签发者或未经中间人篡改。
  • 格式要求:仅支持严格的 3 段紧凑格式(JWS)。若输入为 5 段加密格式(JWE)或段数不为 3,解析将显式报错;Base64URL 片段不得包含非法字符或填充等号。
  • 凭据安全:所有解析纯在浏览器本地内存运行,绝不上报数据。但仍建议在排查时仅使用测试环境合成 Token,避免在公共或共享终端粘贴长期有效的生产管理员 Token。

相关任务与参考链接

Inspect and decode JWT structure offline during API authorization debugging

Use this tool to inspect the header algorithm and payload claims of a JSON Web Token (JWT) offline when troubleshooting API authorization, SSO, or user roles. The tool parses standard compact format (three dot-separated Base64URL segments) directly in your browser. Important: offline decoding only displays token payload contents; it does NOT verify cryptographic signatures or prove that the token is valid or untampered.

Steps

  1. Paste a standard 3-segment compact JWT string (dot-separated header, payload, and signature) into the input area. Never paste real tokens containing production secrets or sensitive credentials.
  2. Examine the decoded views: check the signature algorithm (alg) and type (typ) in the Header, and inspect standard claims (sub, exp expiration, iat issued-at, and custom roles) in the Payload.
  3. Copy or download the formatted JSON structures; verify the signature independently using your server-side public key or authorization logs.

Decode a synthetic JWT specimen with standard claims and developer role

Input

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIiwibmFtZSI6IkFsaWNlIFNtaXRoIiwicm9sZSI6ImRldmVsb3BlciIsImlhdCI6MTcxMDAwMDAwMCwiZXhwIjoxNzEwMDAzNjAwfQ.bW9jay1zeW50aGV0aWMtc2lnbmF0dXJlLWJ5dGVz

Options

Standard compact format (3 Base64URL segments)

Output / inspection

{
  "header": {
    "alg": "HS256",
    "typ": "JWT"
  },
  "payload": {
    "sub": "user-42",
    "name": "Alice Smith",
    "role": "developer",
    "iat": 1710000000,
    "exp": 1710003600
  },
  "signatureVerified": false
}

Limits and common issues

  • Decoding is NOT verification: This tool only performs Base64URL decoding and JSON formatting. It does not possess server keys and does not verify cryptographic signatures. A successfully decoded payload does not prove that the token is authentic, untampered, or accepted by the target resource server.
  • Format constraints: Strictly requires 3-segment compact JWS format. 5-segment encrypted tokens (JWE) or tokens with invalid segment counts will be rejected. Base64URL segments must be unpadded and conform to URL-safe character sets.
  • Credential safety: Decoding occurs strictly within local browser memory without network transmission. However, avoid pasting long-lived production tokens with sensitive claims into shared browser environments; use synthetic or redacted test tokens whenever possible.

Related tasks & reference links