URL-Safe Base64 Encoder - Base64url Encode & Decode
Encoding Tools
Encode text or hex bytes as Base64url, decode with standard Base64 support, compare variants, and inspect JWT claims locally in your browser.
Output updates as you type. All conversion happens in this browser.
Link settings are shared without including your input or JWT.
How to use this tool
- Choose a tool tab. Select Encode or Decode for one conversion, Compare to view the standard and URL-safe spellings, or JWT Peek to inspect a token header and payload.
- Enter text, bytes, or encoded data. Encode UTF-8 text or whitespace-separated hex bytes. Decode accepts Base64url and, when enabled, standard Base64 with whitespace ignored.
- Review the live result. The result updates while you type. Choose optional padding for encoding or switch decoded output between UTF-8 text and hexadecimal bytes.
- Copy or inspect further. Copy a conversion or comparison row. JWT Peek shows human-readable standard time claims but does not verify a signature; use JWT Decoder for additional inspection.
What is Base64url?
Base64url (URL-safe Base64) is defined in RFC 4648 §5. It is identical to standard Base64 except:
+is replaced with-/is replaced with_- Padding (
=) is typically omitted
These changes make the output safe to embed in URLs, file names, and HTTP headers without percent-encoding.
Where is Base64url used?
- JWTs (JSON Web Tokens): header and payload are Base64url-encoded
- OAuth 2.0 PKCE: code verifier and challenge
- WebAuthn / FIDO2: challenge and credential IDs, which are binary values that can be inspected as hex bytes
- URL shorteners: compact binary-to-text IDs
- Web Crypto API: key export formats
These values are bytes, not always human-readable text. Choose Hex bytes when inspecting credential IDs, cryptographic output, or any decoded data that is not valid UTF-8. For ordinary messages, Text (UTF-8) is easier to read. Both modes preserve the same underlying bytes.
Standard Base64 vs Base64url
| Feature | Standard Base64 | Base64url |
|---|---|---|
| Alphabet character +62 | + | - |
| Alphabet character +63 | / | _ |
| Padding | Always (=) | Usually omitted |
| URL safe | No | Yes |
JWT Peek tab
The JWT Peek tab decodes a JSON Web Token's header and payload as you type so you
can inspect claims like sub, iat, exp, and
aud, all without sending the token anywhere.
Numeric iat, nbf, and exp claims are shown as local dates
and relative times using your device clock. Server clock-skew settings can differ. Use the
JWT Decoder for more claim inspection; neither page treats a decoded
token as trusted.
Important: this tool does not verify the signature. Use server-side JWT libraries for trusted verification.
Anatomy of a JWT
A JSON Web Token consists of three Base64url-encoded segments separated by dots:
header.payload.signature. Here is a worked example:
| Segment | Encoded (truncated) | Decoded JSON |
|---|---|---|
| Header | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 | {"alg":"HS256","typ":"JWT"} |
| Payload | eyJzdWIiOiIxMjM0IiwiaWF0IjoxNzAwMDAwMDAwLCJleHAiOjE3MDAwMzYwMDB9 | {"sub":"1234","iat":1700000000,"exp":1700036000} |
| Signature | SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c | HMAC-SHA256 of header + "." + payload; cannot be decoded without the secret |
Common standard claims in the payload: sub (subject - user ID), iat (issued-at - Unix timestamp), exp (expiration - Unix timestamp), aud (audience - intended recipient), iss (issuer). Custom claims can be added for application-specific data.
To prepare a PKCE verifier and challenge, use the OAuth PKCE Generator. For ordinary padded Base64 or file encoding, see the Base64 Encoder. The String Byte Counter can help check UTF-8 byte length before you encode a value.
Frequently asked questions
What is the difference between Base64 and Base64url?
Base64url replaces + with - and / with _ so the output is safe in URLs and filenames. Padding (=) is optional in Base64url and is commonly omitted in JWTs. The encoded data is otherwise the same.
Can I paste standard Base64 or line-wrapped input?
Yes. Decode mode ignores whitespace and accepts the standard + and / alphabet when its compatibility switch is on. It shows a notice when it converts standard Base64 characters. Turn that switch off to require Base64url characters.
Does Base64url encrypt or compress my data?
No. Base64url is an encoding, not encryption or compression. Anyone can decode it, and it usually increases the data size by about one third. Do not use it to hide passwords, tokens, or other sensitive values.
Why does JWT Peek say the signature is not verified?
JWT Peek only decodes the header and payload. It does not check the signature, issuer, audience, or trustworthiness of any claim. Use the JWT Decoder for more claim context, and verify tokens with the appropriate trusted key and server-side library before relying on them.
When should I use Hex bytes instead of UTF-8 text?
Use Hex bytes for binary values such as credential IDs, cryptographic bytes, or data that is not valid UTF-8. Text mode interprets decoded bytes as UTF-8 and reports an error if they are not valid UTF-8; Hex mode displays every byte without changing it.
Related tools
- JWT DecoderInspect JWT claims, time fields, and raw Base64url segments in more detail.
- JWT GeneratorBuild and sign a JSON Web Token after preparing its header and payload.
- OAuth PKCE GeneratorGenerate the verifier and challenge values used by OAuth 2.0 PKCE.
- Base64Encode files or use standard and padded Base64 variants.
- Hex Dump ViewerInspect binary input and output as hexadecimal bytes.
- Byte-Size CounterCheck UTF-8 byte counts before encoding text.