Encode and decode Base64 text or files online, including URL-safe Base64 and MIME line wrapping, entirely in your browser.
Base64
is a way to represent arbitrary binary data using only 64 printable ASCII characters (A–Z,
a–z,
0–9,
+
and
/
). This Base64 encoder and decoder groups the input into 3-byte chunks and re-encodes each as four characters, padding the final group with
=
. It exists so binary can travel safely through text-only channels — email bodies, JSON, data URIs, HTTP headers.
Encoding is
not
encryption. Base64 is fully reversible by anyone, with no key involved — it adds zero secrecy and grows the payload by about a third. The
URL-safe
variant swaps
+//
for
-/_
and usually drops padding, so the value survives inside URLs and filenames. Everything here runs in your browser; the text and files you convert never leave your machine.
Text is converted to UTF-8 bytes first, then encoded. Some typical results:
| Input | Bytes | Standard Base64 | URL-safe |
|---|---|---|---|
Hi! |
3 | SGkh |
SGkh |
hello |
5 | aGVsbG8= |
aGVsbG8 |
é |
2 | w6k= |
w6k |
€ |
3 | 4oKs |
4oKs |
<<???>> |
7 | PDw/Pz8+Pg== |
PDw_Pz8-Pg |
Three bytes always become four characters, so
Hi!
needs no padding, while
hello
(5 bytes) ends with one
=. The accented
é
is two bytes in UTF-8, which is why it encodes to four characters rather than two. The last row shows the URL-safe alphabet replacing
/
and
+
and dropping the padding.
Encoding
user:pa55word
gives
dXNlcjpwYTU1d29yZA==, the value sent in an
Authorization: Basic
header. Switching to Decode reverses it instantly, which is why Basic authentication is only safe over HTTPS.
hello
shows 5 B in, 8 B out, +60%; longer inputs approach +33%, plus one byte per line break when Wrap 76 is on. Decoding shows a negative ratio.
encoded.base64.txt
(or
<file name>.base64.txt
for files) and decoded bytes as
decoded.bin.
data:image/png;base64,, to inline it in HTML or CSS.
data
fields and many CI variables expect Base64; decode them to check what is really stored.
| Symptom | Likely cause | Fix |
|---|---|---|
| “length is not a multiple of 4 (string looks truncated)” | Characters were lost when copying | Copy the complete value again |
| “unexpected character … not in the Base64 alphabet” |
A
data:…;base64,
prefix, quotes, or URL escapes such as
%2B
and
%3D
|
Remove the prefix and quotes; URL-decode the value first |
| “Decoded · binary” for something that should be text | The text was encoded from a legacy charset such as Latin-1 or Windows-1252, not UTF-8 | Download the bytes and open them with the right encoding |
| Downloaded file will not open | Base64 carries no file name or type, so it is saved as decoded.bin |
Rename it with the right extension, such as .png or .pdf |
| Output differs from another encoder | Different URL-safe, padding or line-wrap settings | Match the URL-safe and Wrap 76 toggles to what the other system expects |
Spaces and line breaks in pasted Base64 are ignored, missing
=
padding is added back, and input containing
-
or
_
is treated as URL-safe automatically, so wrapped MIME text and unpadded tokens decode without editing.
data:
URI prefixes.
No. Base64 encoding and decoding run entirely client-side using the browser engine. Files are read locally with the FileReader API and are not sent to a server.
No. Base64 is encoding, not encryption. There is no key and anyone can decode it instantly, so never use Base64 to hide passwords, API keys or private data.
Standard Base64 uses + and /, which can be awkward in URLs and filenames. URL-safe Base64 substitutes - and _ and often omits = padding. This decoder accepts standard and URL-safe variants.
The input may contain a non-Base64 character, be truncated, or have invalid padding. Whitespace and line breaks are ignored automatically; if decoded bytes are not UTF-8 text, download the raw bytes instead.
Switch to Decode, paste the Base64 without any data: URI prefix, and click Download. The raw bytes are saved as decoded.bin; rename it with the correct extension, such as .png or .pdf, because Base64 does not store a file name or type.