There are additional base64 specs. (See the table here for specifics ). But essentially you need 65 chars to encode: 26 lowercase + 26 uppercase + 10 digits = 62.

You need two more ['+', '/'] and a padding char '='. But none of them are url friendly, so just use different chars for them and you're set. The standard ones from the chart above are ['-', '_'], but you could use other chars as long as you decoded them the same, and didn't need to share with others.

I'd recommend just writing your own helpers. Like these from the comments on the php manual page for base64_encode:

function base64_url_encode($input) {
 return strtr(base64_encode($input), '+/=', '-_.');
}

function base64_url_decode($input) {
 return base64_decode(strtr($input, '-_.', '+/='));
}
Answer from Joe Flynn on Stack Overflow
🌐
SimplyCalc
simplycalc.com › base64url-encode.php
(SimplyCalc) base64url encoder
Encode text to base64url, as per RFC-4648. The result is a URL-safe base64url encoded UTF-8 string.
🌐
Base64 Encode
base64encode.org
Base64 Encode and Decode - Online
Enable this option to encode into an URL- and filename- friendly Base64 variant (RFC 4648 / Base64URL) where the "+" and "/" characters are respectively replaced by "-" and "_", as well as the padding "=" signs are omitted.
🌐
Base64.Guru
base64.guru › home › base64 standards › base64url
Base64URL Encode | Base64URL | Base64 Standards | Base64
You can submit the data you want to encode to Base64URL by typing or pasting text, uploading a file, or specifying a URL.
🌐
Medium
medium.com › @bagdasaryanaleksandr97 › understanding-base64-vs-base64-url-encoding-whats-the-difference-31166755bc26
Understanding Base64 vs Base64 URL Encoding: What’s the Difference? | by Aleksandr Bagdasarian | Medium
July 16, 2024 - The standard Base64 characters + and / are replaced with - and _ respectively, and padding characters (=) are omitted, ensuring that the encoded data does not include any characters that have special meanings in URLs.
🌐
Base64Encode.org
base64encode.org › enc › url
Base64 Encoding of "url" - Online
Enable this option to encode into an URL- and filename- friendly Base64 variant (RFC 4648 / Base64URL) where the "+" and "/" characters are respectively replaced by "-" and "_", as well as the padding "=" signs are omitted.
🌐
Base64 Decode
base64decode.org
Base64 Decode and Encode - Online
Other variations, usually derived from Base64, share this property but differ in the symbols chosen for the last two values; an example is the URL and filename safe "RFC 4648 / Base64URL" variant, which uses "-" and "_". ... In the above quote the encoded value of Man is TWFu.
🌐
Base64.Guru
base64.guru › home › base64 converter › base64 encode
URL to Base64 | Base64 Encode | Base64 Converter | Base64
This online converter encodes the contents of remote file or webpage to Base64 (that is, it automatically downloads the remote data and convert it to Base64). To use it, just type or paste the URL and press “Encode URL to Base64” (make sure that the URL is publicly available).
🌐
Oster Miller
ostermiller.org › calc › encode.html
Base64 and URL Encoding and Decoding
Encodes or decodes data in Base64 or URL encoding using client side JavaScript
Find elsewhere
🌐
URL Encode
urlencoder.org › enc › base64
URL Encoding of "base64" - Online
Encode base64 to URL-encoded format with various advanced options. Our site has an easy to use online tool to convert your data.
🌐
Toolsaday
toolsaday.com › encode-decode › base64Url-encode
Base64Url Encode Online | Toolsaday
Encode text to URL-safe Base64 format. Free online tool to encode your given text to base64 url safe format, as per RFC-4648.
🌐
Base64.Guru
base64.guru › home › base64 standards › base64url
Base64URL Decode | Base64URL | Base64 Standards | Base64
Base64URL Decode is a free online tool for decoding Base64URL values to original data. By default, it decodes Base64URL as plain text, nevertheless, it also supports binary data, such as images or other files. If you want to encode data to Base64URL string, check the Base64URL Encoder.
🌐
Toolsaday
toolsaday.com › encode-decode › base64Url-decode
Base64Url Decode Online | Toolsaday
Decode Base64 url safe to plain text. We provide a free tool that decode base64 url to plain text.
🌐
Duende Software
docs.duendesoftware.com › identitymodel › utils › base64
Base64 URL Encoding | Duende Docs
Base64 URL encoding is used instead of standard Base64 because it doesn’t include characters like +, /, or =, making it safe to use directly in URLs and HTTP headers without requiring further encoding.
🌐
Wikipedia
en.wikipedia.org › wiki › Base64
Base64 - Wikipedia
July 30, 2026 - For example, a database persistence framework for Java objects might use Base64 encoding to encode a relatively large unique id (generally 128-bit UUIDs) as a string for use as an HTTP parameter in an HTTP form or an HTTP GET URL.
🌐
Base64Encode.org
base64encode.org › enc › base64url
Base64 Encoding of "base64url" - Online
Enable this option to encode into an URL- and filename- friendly Base64 variant (RFC 4648 / Base64URL) where the "+" and "/" characters are respectively replaced by "-" and "_", as well as the padding "=" signs are omitted.
🌐
Base64
base64.sh › home › all tools › base64url
Base64url Encoder Decoder | URL-Safe Base64 Encoding
The two variants are defined in RFC 4648: • Standard Base64 (§4) — uses A-Z, a-z, 0-9, +, /, padded with =. The + and / characters have special meaning in URLs and filenames. • URL-safe Base64 (§5, also called base64url) — identical except + becomes - and / becomes _. Both variants encode identical data; only the last two alphabet characters differ.
🌐
PHP
php.net › manual › en › function.base64-encode.php
PHP: base64_encode - Manual
Slight improvement on the padding problem in gutzmer at usa dot net (https://www.php.net/manual/en/function.base64-encode.php#103849) and biziclop at vipmail dot hu (https://www.php.net/manual/en/function.base64-encode.php#121767): <?php function base64url_encode($data) { return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); } function base64url_decode($data) { return base64_decode(str_pad(strtr($data, '-_', '+/'), 4 - ((strlen($data) % 4) ?: 4), '=', STR_PAD_RIGHT)); } ?> ... function urlsafe_b64encode($string) { $data = base64_encode($string); $data = str_replace(array('+','/','='),arr