Both Base64 and URL encoding solve the same problem: some data can't be safely carried through a channel designed for text. Base64 lets binary data ride through plain-text systems. URL encoding lets arbitrary characters ride through URLs. Neither is encryption — anyone can reverse either transformation instantly.
Base64 takes groups of 3 bytes (24 bits) and splits them into 4 groups
of 6 bits. Each 6-bit value maps to one of 64 printable characters:
A–Z, a–z, 0–9, plus + and /. The equals sign
= is used as padding when the input length isn't a
multiple of 3.
A side effect: Base64 output is always about 33% larger than the input, because 3 bytes become 4 characters. That's the cost of making arbitrary data safe to embed in text-only systems.
The most common places you'll see Base64: data URLs in HTML and CSS (image embedding), JWT authentication tokens, Basic Auth headers, and any API that accepts or returns binary files as strings.
URLs can only contain a limited set of safe characters. Spaces,
ampersands, question marks, and most non-ASCII characters have
special meaning or aren't allowed. URL encoding (also called
percent-encoding) replaces these characters with a
% followed by two hexadecimal digits representing the
character's UTF-8 bytes.
There are two variants: encodeURIComponent encodes everything that isn't a URL-safe character, so it's meant for single values (like a query parameter). encodeURI preserves URL structure (slashes, colons, question marks), so it's meant for whole URLs. The tool offers both.
The browser's built-in btoa() and atob()
functions work on binary strings, not Unicode text. Pasting an emoji
or accented character into a naive Base64 encoder can produce garbage
or throw an error. This tool first UTF-8-encodes the text, then
Base64-encodes the resulting bytes. Decoding reverses the process,
so accented characters, emoji, and non-Latin scripts all round-trip
correctly.
=?
Padding. If the input length isn't a multiple of 3 bytes, the last
group gets padded with = to make it a clean multiple of
4 characters. Both = and == are valid.
+ for - and
/ for _, because those two characters have
special meaning in URLs. JWTs and many APIs use Base64URL instead of
standard Base64.