首页 全栈极客与开发辅助内容详情

JWT Decoder & Generator: HS256 Sign and Verify In-Browser - Take the token apart, sign what you own

2026-11-17 3 访客
JWT Decoder & Generator: HS256 Sign and Verify In-Browser

站点名称:JWT Decoder & Generator: HS256 Sign and Verify In-Browser

所属分类:全栈极客与开发辅助

官方网址:https://www.9314.cn/tools/jwt-tools/en/

SEO查询: 爱站网 站长工具

进入网站

站点介绍

JWT Decoder & Generator: HS256 Sign and Verify In-Browser

Mid-integration, the backend dev drops an eyJhbGciOiJIUzI1NiIs... in the thread with a single line: use this. Does it expire? Is my username in it? Would a one-character tamper get caught? Back then the answer was a trip to jwt.io. This page was built to that moment's spec: three panes, local signing and verifying.

The short version

  • Three-pane evidence bench: paste the raw token left, header/payload key-values decode live in the middle (iat/exp converted to local time), HS256 signing area right (secret + payload JSON).
  • exp as green/red: expiry is compared against the clock in real time - green with hours and minutes left, red with elapsed time since expiry.
  • Tampering must fail: touch one payload character and verification turns into a signature mismatch - watching that failure succeed is how you know the check works. RS256/PS family verifies with a public key (the page does not generate key pairs).
  • WebCrypto-local computation, zero uploads; token up to 1MB; works offline.

Fair warning first: signed, not encrypted

A JWT is signed by default, not encrypted. The payload is Base64URL - an encoding, not encryption: paste the middle segment into any Base64 decoder and the content reads out plainly. The signature proves the token was not tampered with, not that it was never read.

So passwords, phone numbers and ID numbers never belong in a payload. Confidentiality belongs to TLS on the transport layer or to actual encryption schemes like JWE. This is said three times on the page - the red box up top, the Facts table, and FAQ question one - because it is the single easiest trap to fall into.

Choosing between HS256 and RS256

A monolith that issues and checks its own tokens uses HS256: one secret serves both ends, fast and cheap. Multi-party setups use RS256: the auth service signs with a private key while every other service verifies with the public key - verifiers never hold issuing power, so the leakage surface shrinks dramatically.

This tool signs and verifies HS256; RS256/PS256/384/512 get parsing and public-key verification (bring your own PEM; the page does not generate key pairs - private keys do not belong in a browser).

FAQ

Is a JWT encrypted? Can I put passwords in the payload?

No - underline that three times. A JWT is signed by default, not encrypted: the payload is Base64URL-encoded, which is a transport encoding and not encryption, so anyone who grabs the token can read its contents directly. The signature guarantees the token was not tampered with, not that it was never read. Passwords, phone numbers and ID numbers never belong in a payload; confidentiality belongs to TLS on the transport layer or to actual encryption schemes like JWE.

HS256 or RS256 - which one should I use?

HS256 is symmetric: the same secret signs and verifies, which is fast and simple - a good fit for a monolith that issues and checks its own tokens. RS256 is asymmetric: a private key signs, a public key verifies, which suits multi-party setups - the auth service holds the private key while every other service only gets the public key, so verifiers never gain issuing power. This tool signs and verifies HS256, and parses plus public-key-verifies RS256.

What does a signature mismatch actually mean?

Two possibilities: the token was modified - touch one character of the payload and the recomputed signature stops matching, which is the entire point of signatures - or the key is wrong, meaning the verifier is not using the same secret as the issuer. Try editing one payload character and re-verifying: it must fail, and watching that failure succeed is how you know the check actually works.

Why did the exp box turn red?

exp in the payload is a Unix timestamp - the latest moment this token should be accepted. The page converts it to your local timezone and compares it with the clock: green with remaining time before expiry, red once it has passed. Note that exp is only a claim; the token itself never disappears, and whether an expired token gets rejected is the verifier's policy.

Is my token or secret uploaded anywhere?

No. Parsing, signing and verifying all run in this device's browser via WebCrypto - there is no upload endpoint and it works offline. Only interface preferences live in this browser's localStorage; they do not follow you to another device, and Clear my data in the footer removes them. And do not paste production secrets into any online tool - including this one.

中文版:https://www.9314.cn/tools/jwt-tools/

 暂无评论,快来抢沙发吧~

发布评论