Base64 URL Encoder
Input
URL-Safe Base64 Output
Paste some plain text on the leftabove and the URL-safe Base64 shows up here.Paste some URL-safe Base64 on the leftabove and the decoded text shows up here.
Or .
What is Base64 URL Encoding?
Put normal Base64 in a query string and the + turns into a space on the server, while / looks like a path. Base64url, defined in RFC 4648 §5, writes - and _ instead, so the value survives URLs, file names and headers without percent-encoding.
You meet it most in auth work. The header and payload of a JWT are Base64url, and so is the code challenge in OAuth's PKCE flow.
Encoding uses the browser's btoa() and decoding its atob(), both in this tab, so a token you paste is not sent anywhere.
How to Use the Base64 URL Encoder
Pick a direction with Encode or Decode first; after that the output follows every keystroke. Encoding drops the trailing = padding the way JWTs and PKCE expect, and decoding adds it back before reading the bytes.
Choose Mode and Add Input
Choose Encode to turn text into URL-safe Base64, or Decode for the reverse. Paste into the left Input panel, or click Sample for an example in the current mode. An input to encode:
{"deviceId":"mdm-8c41f2","model":"MacBook Air 13-inch (M3)","site":"Leeds"} View Output
The right panel shows the URL-safe Base64 or the decoded text, and it changes with every keystroke.
Copy, Download, or Swap
Copy and Download take the result away. Swap moves the output into the input and runs the same mode on it again, so to check a round trip, press Swap and then switch to the other mode. Clear empties both panes.
When You'd Actually Use This
JWT Token Inspection
A JWT is three Base64url parts joined by dots. Paste the middle one in Decode mode to see which claims the login service actually issued.
OAuth 2.0 PKCE
PKCE (RFC 7636) sends the Base64url of a SHA-256 hash as the code challenge. This page encodes text, not raw hash bytes, so use it to check the alphabet and padding of a challenge your code produced rather than to compute one.
URL Parameter Encoding
Want a small JSON filter in a link, like a saved search for 14-inch laptops? Encode it here and it goes into the query string with no %2B or %2F. Note that a data URL expects standard Base64, not this variant.
File Names & Headers
A cache key or a generated file name cannot contain /. Base64url output uses only letters, digits, - and _, so it works as either.
Common Questions
Why can't I put normal Base64 in a URL or a JWT?
Standard Base64 (RFC 4648 §4) uses + and /. Base64url replaces those with - and _ to make the output safe for URLs, file names, and HTTP headers without percent-encoding.
Does Base64url use padding (= signs)?
It may or may not. JWTs and PKCE leave the = signs off, and so does this page when it encodes. Decode mode accepts the string either way.
Can I use this for JWT decoding?
For reading it, yes: paste the header or the payload segment on its own. Nothing here checks the signature, so do not treat a decoded token as trusted.
Is the output safe to use directly in a URL?
Yes. The encoded output only contains alphanumeric characters, hyphens (-), and underscores (_), which are all unreserved URL characters per RFC 3986.
Can I use Base64url in cookies?
Yes. Its characters are all allowed in a cookie value, so nothing needs quoting or escaping.
Is Base64 URL encoding the same as URL encoding?
No. Percent-encoding keeps your text readable and escapes only the awkward characters, such as a space as %20. Base64url rewrites all the bytes into a new alphabet, so the result is unreadable but always URL-safe.
Other Base64 Tools You Might Need
For the standard alphabet, or for files rather than text: