b: BYTE INSPECTOR
FIELD GUIDE / ENCODING FUNDAMENTALS

Base64URL decode: alphabet, padding and exact bytes

Decode URL-safe Base64 without guessing the alphabet or hiding a malformed ending.

Open the workbench ↗

Start with the alphabet

Standard Base64 uses A–Z, a–z, 0–9, + and /. Base64URL replaces + with - and / with _. The bytes do not change; the spelling does. In this workbench, selecting Base64URL rejects + and /, and selecting Base64 rejects - and _. A mixed alphabet is an input error.

For example, the byte FB is +w== in standard Base64 and -w== in padded Base64URL. It is a valid byte but not a valid standalone UTF-8 character. Successful Base64 decoding does not guarantee readable text.

Choose a padding contract

RFC 4648 describes padding unless a referring specification says it can be omitted. URL-safe does not automatically mean unpadded. Choose Required for a padded contract, Optional to explicitly permit either form, or Forbidden when your protocol requires an unpadded form. Output in the workbench always labels standard Base64 as padded and Base64URL as unpadded.

InputPolicyResult
Zg==Required / Optional66 → f
ZgOptional / Forbidden66 → f
ZgRequiredMissing two = signs
ZAnyImpossible length

Why canonical pad bits matter

Each Base64 symbol contributes six bits. A single byte needs eight bits, so its second symbol contributes two data bits and four zero fill bits. Some forgiving decoders accept Zh== as the byte 66 even though its fill bits are nonzero. This inspector rejects it; Zg== is the canonical representation. With two remaining bytes, the last symbol must have two zero fill bits.

A precise decoding workflow

  1. Choose Base64URL and the padding rule required by your source protocol.
  2. Paste the encoded segment by itself. No whitespace stripping, URL percent-decoding, or data-URL prefix removal happens silently.
  3. Inspect. The hex panel shows the authoritative bytes. Choose UTF-8 or ASCII explicitly for a text interpretation.
  4. Check the round trip before trusting the text. Download original bytes to preserve binary data.

A JWT consists of dot-separated components; pasting an entire token into a single Base64URL decoder should fail at the dot. This tool is an encoding inspector, not a JWT signature verifier. Encoding provides no confidentiality or proof of authenticity.

RFC golden vectors

These complete Base64 examples from RFC 4648 §10 are small enough to verify by hand. Their URL-safe alphabet is identical because none needs + or /.

TextPadded Base64Unpadded form
(empty)(empty)(empty)
fZg==Zg
foZm8=Zm8
fooZm9vZm9v
foobZm9vYg==Zm9vYg
foobaZm9vYmE=Zm9vYmE
foobarZm9vYmFyZm9vYmFy

References and reproducibility

Encoding rules: RFC 4648 §§3–5 and 10. UTF-8 decoding and BOM behavior: WHATWG Encoding Standard. The workbench uses browser-native text and binary primitives with explicit validation. It does not normalize Unicode or remove line endings.