The quick answer

URL-safe Base64 swaps the alphabet's two troublemakers (+ becomes -, / becomes _) and usually drops the = padding, so encoded data survives in URLs, cookies and JWT segments unchanged. This tool converts both directions in your browser; nothing is uploaded, and it works offline.

Why a URL-safe Base64 variant exists

Standard Base64 has two characters that URLs treat as grammar: + means a space in query strings, and / separates path segments. Encode binary data with them and the moment it travels through a URL, something interprets it. URL-safe Base64 (RFC 4648 §5) fixes exactly that: + becomes -, / becomes _, and the = padding is usually omitted. The result rides through URLs, cookies and JWT segments untouched.

The stakes are higher here than on most tool pages: the strings being encoded are API keys, tokens, headers, passwords and certificate material. Encoding client-side removes the entire risk class, because there is no request to intercept and no server log that records your token. That is the bar this page is built to.

Encoding or decoding, step by step

  1. Load an example or paste your own data

    The Load example button fills the input with the sample string 'Hello, World!'; otherwise paste your own. The tool works live: you paste data, pick the direction (encode or decode), and the conversion is instant.

  2. Pick the direction

    Two buttons, Encode and Decode, switch the transformation between its two directions; the output re-renders instantly with each change.

  3. Review the output panel

    The output panel re-renders on every keystroke, and a note line beneath it reports anything unusual, such as an invalid character pasted into the decoder, instead of failing silently.

  4. Copy, download or continue

    Copy puts the result on your clipboard; Download writes it as a file; and where chaining makes sense, "Use as input" pipes the output straight back for the next transformation.

  5. Verify with the worked example

    The methodology section below shows exactly what the tool computes, with a real worked example: the fastest way to confirm your understanding matches the tool's behavior.

  6. Clear when done

    Clear wipes the input instantly. Because processing is local, there is no history, no server copy and no residue: privacy by architecture.

That is the entire workflow. Because every intermediate result is visible and the page documents its own method below, you never have to trust a black box: you can check the working at any point.

The alphabet swap: + and / become - and _

The mechanics are a two-character substitution on an otherwise identical codec. Both alphabets start the same (A-Z, a-z, 0-9) and both pack 3 bytes into 4 characters at 33% overhead. Only positions 62 and 63 differ: standard Base64 fills them with + and /, URL-safe Base64 with - and _. See it with the bytes FB EF BE: standard encodes them as ++++, URL-safe as ----. Same bytes, same length, different costume for a different destination.

Padding is the second difference. Standard Base64 ends incomplete groups with = (AB encodes as QUI=), and in a URL that equals sign must itself be percent-encoded as %3D, doubling the ugliness. URL-safe Base64 simply omits the padding, and decoding never needs it: the remaining characters determine every byte. JWTs take this further by mandate: RFC 7515 requires base64url encoding without padding for every segment.

Converting between the two forms is lossless and instant: translate the two alphabet positions, add or strip padding, done. What this tool will not do is silently fix ambiguity. Paste standard Base64 containing + into the URL-safe decoder and the note line reports an invalid-character error instead, which is better than decoding to the wrong bytes quietly.

Who needs URL-safe Base64

Two profiles cover most real-world use.

Backend developers: every JWT is three Base64URL segments; OAuth state parameters and DPoP proofs carry URL-safe encodings; JWK keys in discovery documents use the same alphabet. When a token round-trip fails in staging, checking which alphabet each side actually used is the five-second diagnosis this tab exists for.

Front-end developers: state that must survive a redirect, binary blobs in localStorage and one-time tokens in query strings need encoding the URL parser will not mangle or double-encode into %2B soup. Encoding here means the value lands in the address bar exactly as computed, with no + becoming a surprise space.

The common thread across those workflows is impatience, the productive kind. People want the conversion, not a relationship with a website, so that is all this page asks for.

Where Base64URL appears in the wild

Once you know the alphabet, you see it everywhere. JWT headers and payloads (RFC 7515 mandates base64url, unpadded). JWK public keys in .well-known/jwks.json. WebAuthn attestation and assertion objects. Encrypted key sets (JWE) in enterprise SSO. Short-lived signed URLs in cloud storage. Every place where binary has to ride inside a URL, the URL-safe alphabet is the dialect being spoken.

A practical note on choosing forms: use URL-safe Base64 whenever the output's destination is a URL, cookie or header; use standard Base64 when the destination is MIME email, an XML blob or a data URL, where + and / are harmless and the receiving software expects the classic alphabet. This page handles the URL-safe alphabet in both directions; the standard-alphabet sibling tool is linked below.

Gotchas: padding and alphabet mismatches

  • A Base64URL string fails to decode in another library: most strict decoders require the = padding the JWT world omits. Re-add padding until the length is a multiple of 4, two = signs when the string is 2 short and one when it is 1 short, and the same string decodes everywhere.
  • A standard Base64 string pasted into URL-safe decoding errors out: it contains + or / characters that have no -/_ counterpart. That loud failure is correct behavior, because guessing would decode to the wrong bytes silently.

Your tokens never leave the browser

Nothing leaves this tab: encoding and decoding run as plain JavaScript in the browser, with no network call anywhere in the code path. The strings people encode here are session tokens, signed URLs and one-time credentials, exactly the material that should never cross an unnecessary boundary. Local processing is not a feature of this tool; it is the architecture, and it keeps working with your Wi-Fi off.

Compared with built-ins, CLIs and libraries

AlternativeWhy people pick URL-Safe Base64 instead
JavaScript built-ins (btoa/atob)Standard Base64 only: no URL-safe alphabet or padding handling, which is exactly where tokens break
Command-line tools (base64, openssl)Exact conversion when the terminal is already open; flags and shell history are the price
Language libraries (base64url, jwt)The production choice; the tab is for inspecting and fixing what those libraries emitted

When the output looks wrong

When something behaves unexpectedly, the causes are almost always one of these:

  • Decoded output is nonsense because the two alphabets were mixed: a - or _ from URL-safe Base64 fed to a standard decoder (or + and / the other way). Convert the alphabet first; the bytes then decode cleanly.
  • A token grows by 2 characters somewhere in the pipeline: the = padding was re-added or the URL layer percent-encoded it to %3D. Compare lengths mod 4 to find where the form changed.

If something still resists fixing, a short message on the contact page gets read by a human who can reproduce, fix and ship URL-Safe Base64 corrections quickly.

Frequently asked questions

These are the questions people actually search about URL-safe Base64, answered directly. If yours is missing, the contact page takes feature and question requests.

Is the URL-Safe Base64 tool free to use?

Yes, zero cost and zero gates: open the page, use it as much as you like. URL-Safe Base64 runs entirely in your browser, so each extra use costs this site nothing and costs you nothing either. Clear your cache and reload as often as the job requires.

What is the difference between Base64 and URL-safe Base64?

Two alphabet positions and the padding. Standard Base64 uses + and / as its 62nd and 63rd characters and pads incomplete groups with =; URL-safe Base64 uses - and _ in those slots and omits the padding. The bytes, the 4-characters-per-3-bytes ratio and the 33% overhead are identical; only the costume differs. The bytes FB EF BE encode as ++++ in standard and ---- in URL-safe.

Does Base64 need a key to reverse?

No key, ever: both variants are encodings, not encryption. The output is the input's bytes in a URL-safe alphabet, reversible by anyone who holds the string. URL-safe Base64 makes data transportable, never secret; treat any credential encoded this way as fully readable.

Why does JWT use URL-safe Base64 without padding?

Because JWT segments live in HTTP headers and URLs where +, / and = cause trouble: + can be read as a space, / splits paths, and = would need percent-encoding as %3D. RFC 7515 therefore mandates base64url without padding for header, payload and signature. The decoder does not need the padding: the unpadded string already determines every byte, so it decodes directly.

Can I use the URL-Safe Base64 tool offline?

Yes: everything the tool computes happens in your tab, so a cached page delivers full functionality with the network off. That is not a convenience claim but the architecture: the codec needs no server, which is also why nothing you encode can leak.

Does pasting tokens and keys here put them at risk?

No, by construction: encoding is pure local computation, your input never transmits, and the page works offline after loading, so there is no request to leak. Open the network tab and watch it stay empty while you work. The habit caution stands: secrets belong in as few places as possible, even local ones.

Tools that pair well with URL-safe encoding

These tools share this page's workflow most often; the internal links exist because people genuinely chain them.

  • Base64 Encoder/Decoder: the standard-alphabet sibling for MIME attachments, XML blobs and data URLs.
  • URL Encoder/Decoder: percent-encoding for the query strings this tool's output rides in.
  • HTML Entity Encoder/Decoder: the other character-set escape, for ampersands and angle brackets in HTML.
  • Password Generator: generates the API keys and secrets that so often need URL-safe transport.
  • What Is My IP: network context when a payload's origin matters.

The takeaway

One alphabet swap, both directions, one keystroke each: that is URL-safe Base64 in a sentence. The method is on this page, the FB-EF-BE example is a real computation, and your tokens stay on your device. That is the whole deal.

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.