🔗 Base64URL Encoder
Encode and decode Base64URL, the URL-safe variant of Base64. Uses - and _ instead of + and /, with no padding.
About Base64URL
Base64URL is a URL-safe variant of Base64 defined in RFC 4648. It replaces the characters + and / with - (hyphen) and _ (underscore) so the encoded output can be safely used in URLs, filenames, and query parameters without further escaping. It also omits the = padding characters. This tool runs entirely in your browser — nothing is uploaded.
How it works
- Encode — The input is UTF-8 encoded, then Base64-encoded using the browser's native
btoa. The result has+replaced with-,/replaced with_, and any trailing=padding removed. - Decode — The input has
-restored to+and_restored to/, padding is re-added to make the length a multiple of 4, thenatobdecodes it back to a UTF-8 string. - The alphabet is
A-Z a-z 0-9 - _(64 characters), with no padding. - Base64URL is widely used in JWT tokens, data URIs, and URL-safe identifiers.
Use cases
- Encoding JWT (JSON Web Token) header and payload segments.
- Passing binary data in URLs, query strings, or fragments without escaping.
- Creating URL-safe filenames from binary or text content.
- Exchanging data in environments where
+and/have special meaning.
Frequently asked questions
What's the difference between Base64 and Base64URL? Base64 uses +, /, and = padding, which are not URL-safe. Base64URL swaps them for -, _, and removes padding, so the output can go directly into a URL.
Is Base64URL reversible? Yes. Every Base64URL string can be decoded back to the original bytes. Padding is optional and re-added automatically during decoding.
Why is padding removed? Padding (=) must be percent-encoded in URLs, which defeats the purpose of a URL-safe encoding. RFC 4648 allows omitting it when the length is known from context.
Does this tool upload my text? No. All encoding and decoding happens locally in your browser.