plain/devtools home

Base64URL vs Base64

Base64URL is Base64 with + replaced by -, / replaced by _, and the = padding usually omitted. It is the form used in URLs, filenames and JWTs.

Last reviewed 2026-11-04.

base64samplesCtrl↵ run · s sample · c copy

never leaves your browser

Worked example

The text subjects?_d>>> encodes to:

VariantOutput
Base64c3ViamVjdHM/X2Q+Pj4=
Base64URLc3ViamVjdHM_X2Q-Pj4

Tick "URL-safe" in the tool to switch. The 62nd and 63rd characters differ and the padding goes.

Differences

  • Alphabet: Base64 uses + and /; Base64URL uses - and _. Both use A-Z a-z 0-9 for the rest.
  • Padding: standard Base64 pads with = to a multiple of 4; Base64URL typically omits it (RFC 7515 for JWT requires omitting it).
  • +, / and = have special meaning in URLs and query strings, which is why the URL form exists.

Converting by hand

To go from Base64URL to Base64: replace - with +, _ with /, then add = until the length is a multiple of 4. A JWT header or payload is Base64URL; see how to decode a JWT.

Running this on a server

If you generate tokens or links on a server, the hosting guide compares small hosts.

Frequently asked questions

Can a Base64 decoder read Base64URL?

Not always. Strict decoders reject - and _. Convert the alphabet first, or use a Base64URL-aware decoder.

Is Base64URL shorter?

Slightly, because the padding is dropped.

Which does a JWT use?

Base64URL without padding for all three parts.

Sources

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc