Skip to content
86% off$349 $48.86code BF2026

Guides

How to Decode a JWT Token on Mac (Offline and in Terminal)

Decode a JWT on your Mac without pasting it into a website: a Terminal one-liner, offline decoding with expiry checks, and signature verification with a key.

GuideUpdated 10 min read

On this page

To decode a JWT token, split it at the dots and Base64URL-decode the first two parts, the header and the payload. On a Mac you can do this in Terminal with one line that reads the token from your clipboard (below). You can also decode it offline in an app that shows expiry and verifies the signature. Decoding only lets you read the token. It doesn't prove the token is genuine.

What's inside a JWT

A signed JWT is three Base64URL strings joined by dots: header.payload.signature.

  • Header: JSON that names the signing algorithm (alg, such as HS256 or RS256), usually typ, and sometimes a key ID (kid).
  • Payload: JSON "claims" about the user or session. Common claims are iss (issuer), sub (subject), aud (audience), exp (expires), nbf (not before) and iat (issued at). The three time claims are Unix timestamps in seconds.
  • Signature: bytes computed over header.payload with a secret or private key. This part has nothing to read. You can only check it.

The header and payload are encoded, not encrypted, so anyone who has the token can read them. This is also why almost every JWT starts with eyJ: that's how the header's opening {" comes out in Base64.

A token with five dot-separated parts instead of three is an encrypted JWT (JWE). None of the methods on this page can read its payload without the decryption key.

Decode a JWT token in Terminal

macOS includes the base64 command, but JWTs use the URL-safe Base64 alphabet (- and _ instead of + and /) and leave out the = padding. Running plain base64 -d on a raw JWT segment often gives an error or garbled output. This one-liner handles both problems:

  1. Copy the token.
  2. Open Terminal and run:
bash
p=$(pbpaste | cut -d. -f2 | tr '_-' '/+'); while [ $(( ${#p} % 4 )) -ne 0 ]; do p="$p="; done; echo "$p" | base64 -d; echo

The command takes the second segment (the payload) from your clipboard and swaps the URL-safe characters back. It then pads the segment to a multiple of 4 characters and decodes it. No settings are changed.

To read the header, change -f2 to -f1. If the token starts with Bearer , remove that prefix first or the header won't decode.

Read the token with pbpaste rather than typing TOKEN=eyJ… at the prompt. A typed token ends up in your shell history file.

The output is compact JSON. If you have jq installed, add | jq . after base64 -d to pretty-print it. To turn an exp value into a date, use the built-in date command:

bash
date -r 1700000000

This prints the Unix timestamp as a local date and time. Add -u to see it in UTC. For more ways to convert timestamps, see how to convert a Unix timestamp on Mac. For more on the base64 command, see how to encode and decode Base64 on Mac.

The one-liner can't check the signature, tell you whether the token has expired, or read encrypted (five-part) tokens.

Decoding is not verifying

Decoding shows you what a token claims. Anyone can write a payload that says "role": "admin" and Base64-encode it. Verification recomputes the signature and compares it with the third segment. It uses a shared secret for HS256, HS384 and HS512, or a public key for the RSA, ECDSA and EdDSA algorithms. A token that passes was signed by someone who holds that key and hasn't been changed since.

Watch for two cases:

  • A token with "alg": "none" has no signature. Treat it as untrusted.
  • An exp in the future doesn't make a token valid. It only means the token hasn't expired yet.

Before you paste a token into a website

jwt.io, from Auth0, is the best-known web tool for this. As of November 2026 it's free, and it can decode, verify and generate JWTs. Auth0 staff have said that decoding and signature verification happen locally in your browser and that tokens aren't sent to Auth0's servers. The site's recent redesign removed the on-page note that said so, but staff confirmed the behavior hadn't changed. For test tokens and tokens from a local dev server, it does the job.

Production tokens are a different matter. A live access token is a credential: whoever holds it can usually act as that user until it expires. Pasting it into a web page means trusting that page's code as it is right then, plus any browser extension that can read the page. Your company may also forbid putting credentials into third-party sites, whatever the site does with them. Decode those tokens on your own Mac.

Decode a JWT offline and check expiry in Bytepliers

Bytepliers is our Mac app of offline developer tools. Its JWT Decoder makes no network requests. Bytepliers requires macOS 14 Sonoma or later.

  1. Copy the token.
  2. Open Bytepliers and press ⌘4 (Command-4) to open JWT Decoder.
  3. Paste the token into Token. A Bearer prefix is fine.
  4. Read the decoded Header and Payload JSON.
JWT Decoder Decode tab with an HS256 token, Header and Payload panes and a red Expired badge with Issued At and Expires times
Expired tokens get a red badge.

Bytepliers shows the token's alg and a status badge: Expired, Not Yet Valid, Valid or No Expiry. It also shows iat, nbf and exp with relative times, so you don't need to convert timestamps by hand. A token with alg: none is marked Unsigned.

The Valid badge describes the time window only. You check the signature separately, as described in the next section.

Decode from the clipboard in any app

For a quick look, you don't need to open the main window:

  • Quick Panel: press ⌥⌘B (Option-Command-B, the default) in any app. With a JWT on the clipboard, it shows the payload plus the algorithm, dates and expiry status. Press ⏎ to copy the result or ⎋ to close the panel. See Quick Panel, Instant Replace and the menu bar.
  • Instant Replace: press ⌥⇧⌘B (Option-Shift-Command-B, the default) to replace the clipboard with the token's payload JSON. To get the token back, choose Tools ▸ Restore Previous Clipboard.
  • Command line: install the bytepliers command with Settings ▸ Integrations ▸ Command-Line Tool ▸ Install…. Then run pbpaste | bytepliers jwt for the payload, or pbpaste | bytepliers jwt --header for the header. bytepliers ts 1700000000 converts an exp value to UTC, local and relative times. The command doesn't use the network and works while the app is closed. See the bytepliers command-line tool.
  • Finder: select a .jwt file and press Space. The Quick Look preview shows the algorithm, an expiry badge, the header and the payload, labeled "Signature not verified".

Verify the signature with a secret or public key

In the Decode tab, the Signature pane checks the token against a key you supply. Bytepliers doesn't fetch keys on its own, so you need the key itself.

  1. Paste the token into Token.
  2. In the Signature pane, choose Secret or Public key to match the token's alg:
    • HS256, HS384, HS512: choose Secret. Set its encoding to UTF-8, Base64 or Hex, depending on how the secret is stored.
    • RS, PS, ES and EdDSA algorithms: choose Public key. Paste a PEM block (PUBLIC KEY, RSA PUBLIC KEY or CERTIFICATE), a bare Base64 DER key, a JWK, or a JWK Set with a kid.
  3. Read the result.
JWT Decoder with an RS256 token, a PEM public key in the Public key field and a green Signature verified chip
Paste the issuer's public key to verify an RS256 token.
ResultWhat it means
Signature verifiedThe signature matches this key.
Invalid signatureThe signature doesn't match. The secret, its encoding or the key is wrong, or the token was changed.
Unsigned tokenThe token uses alg: none, so there's nothing to verify.
Unsupported alg …Bytepliers can't check this algorithm.
Key not usableBytepliers couldn't use the pasted key for this token. Check the key's type and format.

If your identity provider publishes its public keys at a JWKS URL, copy the JSON from that URL and paste the whole set. JSON Formatter's Open URL or cURL sheet (⌘U) can fetch it for you. The sheet connects only when you click Send, and it asks before contacting a host for the first time.

Keys stay in memory and are never saved. By default they're cleared when you leave the tool. To keep them while you switch between tools, turn on Remember keys. They're then kept until you quit Bytepliers.

Create a test token

The Encode tab signs your own tokens. Use it to test an API or reproduce a bug.

  1. Open JWT Decoder and switch to Encode.
  2. Edit the Header and Payload JSON. Both start with a sample: an HS256 header and an example payload.
  3. Choose an Algorithm: HS256/384/512, RS256/384/512, PS256/384/512, ES256/384/512 or EdDSA (Ed25519).
  4. To add timestamps, use the Claims menu: Set iat to Now or Set exp to 1 Hour from Now.
  5. For HS algorithms, enter a Secret. For the others, enter a Private key: PEM PRIVATE KEY, RSA PRIVATE KEY or EC PRIVATE KEY, or a JWK.
  6. Copy the Token with ⇧⌘C (Shift-Command-C).

To check the new token right away, click Verify in Decoder.

Keep tokens out of history and clipboard managers

Tokens usually leak through the tools around the decoder: shell history, clipboard managers, saved inputs. Bytepliers handles these by default:

  • History: Bytepliers saves recent inputs for each tool, but it never records anything you type or paste into JWT Decoder. It also skips text in any other tool that contains a JWT, a private key, a bearer token or an Authorization header line. These rules apply unless you turn on Settings ▸ History ▸ Also record inputs that look like secrets, which is off by default. Signing and verification keys are never saved to history, even with that setting on.
  • Clipboard managers: when you copy from JWT Decoder, Bytepliers marks the clipboard item as concealed (org.nspasteboard.ConcealedType). Clipboard managers that honor this convention don't store it. These include Paste, Maccy, Raycast, Alfred and 1Password. Quick Panel and Instant Replace results that come from a token are concealed as well.
  • Network: JWT Decoder makes no network requests. For everything the app does connect to, see Bytepliers privacy and data.

In Terminal, use pbpaste rather than typing the token. If you already typed one, delete that line from your history file. For zsh, the default shell, the file is ~/.zsh_history. To clear the clipboard when you're done:

bash
printf '' | pbcopy

This replaces the clipboard with empty text. Any copy a clipboard manager already saved stays where it is.

Which method to use

MethodWorks offlineVerifies signatureCreates tokensPrice (as of November 2026)
Terminal one-linerYesNoNoFree, built into macOS
jwt.ioNo, the page must loadYesYesFree
Bytepliers JWT DecoderYesYes, with a secret or public keyYesPart of MacSuite, $349 one-time
bytepliers jwt commandYesNoNoIncluded with Bytepliers
  • Use the Terminal one-liner if you only read a claim now and then.
  • Use jwt.io for test tokens if you're fine working in a browser.
  • Use Bytepliers if you handle production tokens, check expiry often, or need to verify signatures without leaving your Mac.

Bytepliers is part of MacSuite; you can try it free for 7 days.

If it doesn't work

  • base64 -d prints an error or garbled characters. You probably decoded the whole token, or a segment without fixing the alphabet and padding. Use the one-liner above. It decodes a single segment and adds the padding.
  • The payload decodes but the header doesn't. The token probably starts with Bearer , and the prefix ends up in the first segment. Remove it. JWT Decoder in Bytepliers accepts the prefix as is.
  • The output is binary noise, or the token has five parts. It's an encrypted JWE, not a signed JWT. You need the decryption key, and none of these tools can read it.
  • "Invalid signature" with the right secret. Check the encoding. A secret stored as Base64 in a config file needs Base64, not UTF-8. Also look for spaces or line breaks that were copied along with the token or secret.
  • "Invalid signature" with a public key. The provider may have rotated its keys. Compare the token's kid with the key set and paste the current JWKS.
  • bytepliers says "Open Bytepliers once to enable the command-line tool." Open the app once so it can write the file the command needs. If the shell says the command isn't found after you installed to ~/.local/bin, add that folder to your shell's PATH.

FAQ

Can I decode a JWT without the secret? Yes. The header and payload are only Base64URL-encoded, so anyone can read them. You need a secret or public key to verify the signature, and a secret or private key to create a token.

Does decoding a JWT reveal the signing key? No. The signature is computed from the key, but the key can't be recovered from it. Remember that anyone can read the payload, so it shouldn't contain secrets.

Where does the token say when it expires? In the payload's exp claim, in Unix seconds. Bytepliers shows it as a relative time with an Expired or Valid badge. In Terminal, date -r <value> converts it to a date.

Every app.
One purchase.