Base64 Encoding and Decoding Explained
You will see Base64 in Basic auth, webhooks, and Data URLs. It only changes how bytes are written. Anyone can decode it. Split text vs images before you paste.
What is Base64?
Base64 writes arbitrary bytes as 64 printable characters. Three bytes become four chars; = pads short inputs. The alphabet is A–Z, a–z, 0–9, plus + / (URL-safe uses - _). The point is to carry binary through text-only channels: headers, XML, JSON strings, email.
It is not encryption and not compression. Size grows by about a third, and the mapping is public. “Base64 the password” is not hiding it. Digests belong on the hash generator. JWTs need dot-splitting; see the JWT guide.
Keep strings and pictures apart: Base64 encode/decode for text; image Base64 for data:image/...;base64,. Mixing them treats bytes as the wrong charset or forgets the Data URL prefix.
Why it exists
HTTP Basic auth Base64-encodes user:pass into Authorization. That only avoids raw punctuation in the header. Use HTTPS. Decoding a Basic field while debugging a 401 is not “cracking a password”.
JSON cannot hold arbitrary bytes. Small blobs get Base64’d into a field. It is a poor size strategy and a common debug step when someone pastes a long run of letters.
Tiny icons as Data URLs can skip a request. Large PNGs should be compressed or stored as files, not inlined into HTML.
How to encode and decode
For text, open the Base64 tool. Encode UTF-8 for non-ASCII. Do not mix URL-safe and standard alphabets.
If decode fails, check length modulo 4, missing = eaten by chat apps, or whether the string is actually hex or percent-encoding. Percent-encoding is URL encode.
JWT JSON segments are Base64URL. Do not treat the whole token as one Base64 string. For files, build a Data URL on the image page.
Safety and mix-ups
People search “Base64 encryption”. The word is wrong. Encoding is reversible. Encryption needs a key. Our string-cipher page is a demo, not a product control.
Do not decode production Basic headers on a shared screen. Local tools still leak via clipboard. More converters sit on the encoding hub.
Padding rules differ. Align alphabet and length before blaming the site.
Related tools
FAQ
Is Base64 encryption?
No. Public mapping, no key, trivial to reverse.
Why is decoded text garbage?
Wrong charset, mixed alphabets, or the source was not Base64.
Why a separate image page?
Images need a Data URL prefix and a file picker. Separate URLs keep the queries clean.
Can I drop the trailing equals signs?
Standard Base64 uses `=` padding. Some contexts omit it if both sides agree. JWTs often use unpadded Base64URL.
Base64 vs hex vs URL encoding?
Base64 for binary-in-text; percent-encoding for query reserved characters; hex for byte inspection. Do not stack them without a spec.