Skip to main content
Preparing workspace

Base64 URL Encoder

Encode text or hex to URL-safe base64url (- and _ instead of + and /, no = padding) or decode base64url and JWT parts back to text. Runs in your browser.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

Base64 URL Encoder — URL-Safe base64url

Encode text, standard Base64 or hex into URL-safe base64url (RFC 4648 §5), or decode base64url and JWT segments back to text and hex.

Base64url is Base64 with two characters swapped so it is safe in URLs: + becomes -, / becomes _, and the trailing = padding is dropped (RFC 4648 §5). "Hello?>>" is SGVsbG8/Pj4= in standard Base64 and SGVsbG8_Pj4 in base64url. Encode text, Base64 or hex here, or switch to Decode to turn base64url or a JWT back into text.

How to use Base64 URL Encoder

  1. Choose Encode (or Decode to reverse a base64url string or JWT). Paste your value into the input box, then set "Interpret input as" to Plain text (UTF-8), Standard Base64 or Hex bytes so the tool reads the right bytes — hex accepts spaces, colons and 0x prefixes.

  2. Choose your output options: leave the `=` padding off for URLs and JWT segments, tick "Keep = padding" when the receiving decoder demands canonical Base64, and tick "Wrap at 76 characters" for MIME-style line breaks.

  3. Read the panel — payload bytes, base64url length, encoding overhead and a Fits/Over verdict against the 2,000-character URL, 8,190-character Apache and 4,096-byte cookie limits — then click Copy result, or Copy standard Base64 for the `+`/`/` form.

Why use Base64 URL Encoder

  • Three input formats

    Plain UTF-8 text, standard Base64 (either alphabet) and hex bytes — with spaces, colons and 0x prefixes tolerated — all encode to the same base64url output.

  • Padding under your control

    Drop the trailing = for URLs and JWT segments, or tick one box to keep it when the decoder on the other side insists on canonical Base64.

  • Sized against limits that actually break

    Every result is checked against the 2,000-character interoperable URL length, Apache's 8,190-character LimitRequestLine and the 4,096-byte per-cookie ceiling, with a Fits/Over verdict for each.

  • Nothing leaves your browser

    Encoding uses the browser's built-in TextEncoder and btoa — no upload, no API call and no account, so tokens and secrets stay on your machine.

Common use cases

  • Encode a small JSON claim set into a token segment that survives a query string without percent-escaping
  • Convert a hex HMAC or hash digest into the compact base64url form an API or webhook signature header expects
  • Check before shipping whether an encoded state or session parameter still fits inside a 4 KB cookie

Frequently asked questions

What is a Base64 URL encoder?

It is a converter that produces base64url instead of standard Base64 — the alphabet in RFC 4648 §5, where value 62 is written `-` instead of `+` and value 63 is written `_` instead of `/`. Those two substitutions, plus dropping the `=` padding, leave only characters that are legal unescaped in a query string, a path segment and a filename. This tool takes plain text, standard Base64 or hex bytes as input and returns that form.

Link to answer
What is the difference between Base64 and URL-safe Base64?

Exactly two characters, plus padding. Standard Base64 uses `+` and `/` for values 62 and 63; base64url uses `-` and `_` instead, and normally omits the trailing `=`. The 64-character payload alphabet is otherwise identical, so both encode the same bytes to the same length — you can convert between them with a search-and-replace, which is what this tool does after decoding your input to raw bytes.

Link to answer
Is base64url the same as URL-encoding a Base64 string?

No, and base64url is shorter. Percent-encoding turns each `+`, `/` and `=` into a three-character escape (`%2B`, `%2F`, `%3D`), costing two extra characters every time. base64url swaps those characters for URL-legal ones at no cost. The tool shows both lengths side by side, plus how many characters you save.

Link to answer
Should I remove the = padding?

For URLs and JWTs, yes — RFC 7515 §2 requires JWT segments to have the padding removed, and `=` is a reserved character in URLs. Keep it only when the decoder on the receiving side is strict about canonical Base64. Padding carries no information: length modulo 4 always tells a decoder whether one or two characters were trimmed.

Link to answer
How long will my base64url string be?

Divide the byte count by 3, round up, and multiply by 4 for the padded length; unpadded it is ceil(bytes × 4 ÷ 3). A 53-byte JSON payload, for example, becomes 72 padded characters or 71 unpadded. Base64 always costs about a third more than the raw bytes, and the tool reports the exact overhead percentage for your input.

Link to answer
How do I decode base64url?

Switch to Decode and paste the string. The tool turns - back into +, _ back into /, restores the missing = padding, and shows the bytes as UTF-8 text and hex — SGVsbG8_Pj4 decodes to Hello?>>. Paste a whole JWT (header.payload.signature) and the header and payload are decoded separately; the signature is not verified.

Link to answer
How do I Base64-encode a URL itself?

Leave "Interpret input as" on Plain text (UTF-8) and paste the whole address — https://example.com/path?a=1 and all. The URL is just text, so it is read as UTF-8 bytes and encoded like any other string, and because the output is base64url it can then be dropped into a query parameter, a path segment or a filename without any percent-escaping. That is the difference from URL-encoding: percent-encoding escapes the characters a URL cannot carry, while this replaces the whole string with an alphabet a URL can carry as-is.

Link to answer

Embed this tool on your site

Add the Base64 URL Encoder widget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.

<iframe src="https://www.altftool.com/embed/widget/base64-url-encoder"
  title="Base64 URL Encoder — free AltFTool widget"
  width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
  loading="lazy" referrerpolicy="no-referrer-when-downgrade" allow="clipboard-write"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/base64-url-encoder?utm_source=embed&utm_medium=widget" rel="nofollow">AltFTool — free online tools</a></p>

Browse all embeddable widgets →