How to use the Base64 tool
- Encode text: type or paste text and the Base64 version appears immediately. Tick URL-safe if the result will go into a link, a filename or a JWT.
- Decode Base64: paste a Base64 string. If it holds text, you see the text. If it holds an image, PDF or other binary data, the tool says so and offers a download.
- Encode a file: choose a file up to 5 MB to get its Base64 string, optionally as a ready-to-use
data:URI for embedding small images in HTML or CSS.
Everything is processed locally. Text is converted through UTF-8, so accented letters, Urdu, Arabic, Chinese and emoji encode and decode correctly, which the plain browser function btoa() cannot do on its own.
What Base64 is, and what it is not
Base64 turns any sequence of bytes into plain text using 64 safe characters: A–Z, a–z, 0–9, plus and slash, with equals signs as padding. It exists because many systems, such as email bodies, JSON fields, URLs and HTML attributes, can only carry text. Base64 lets binary data travel through them without being corrupted.
It is not encryption. Anyone can decode Base64 in a second, and there is no key. Never use it to hide passwords or secrets. If you find a password stored as Base64, treat it as stored in plain text.
How the encoding works
Base64 reads the input three bytes (24 bits) at a time and splits those bits into four groups of six. Each six-bit group, a number from 0 to 63, picks one character from the alphabet. When the input is not a multiple of three bytes, one or two = signs are added so the output length is a multiple of four.
3 bytes in → 4 characters out, so the output is about 33% longer "Man" = 01001101 01100001 01101110 → 010011 010110 000101 101110 → T W F u → "TWFu"
The URL-safe variant from RFC 4648 swaps + for - and / for _, because plus and slash have special meanings in URLs, and usually drops the padding.
Worked example
- The text
Hello, World!is 13 bytes and encodes toSGVsbG8sIFdvcmxkIQ==(20 characters, with two padding signs because 13 is one more than a multiple of three). - The single word
Manis exactly 3 bytes and givesTWFuwith no padding. - The text
caféis 5 bytes in UTF-8 (the é takes two) and encodes toY2Fmw6k=. A tool that encodes characters instead of UTF-8 bytes would give a different, non-standard string.
Where Base64 shows up
| Place | What it carries | Variant |
|---|---|---|
| Email attachments (MIME) | Files inside text messages | Standard, line-wrapped |
| Data URIs in HTML and CSS | Small images and fonts | Standard |
| JSON Web Tokens (JWT) | Header and payload sections | URL-safe, no padding |
| HTTP Basic authentication | username:password pair | Standard |
| PEM certificates and keys | Binary certificate data | Standard, 64-character lines |
The decoder ignores spaces and line breaks, so wrapped PEM blocks and email chunks paste in without cleanup. It also accepts either alphabet and missing padding.
Using Base64 for small images in web pages
A data URI lets you place a small image directly inside HTML or CSS, so the browser does not need a separate request. Encode the image file here with the data URI option ticked, then use it like this:
<img src="data:image/png;base64,iVBORw0KGgo…" alt="Icon">
This is a good fit for icons under about 2 KB, because it saves a network request. For anything larger it usually hurts: Base64 makes the data a third bigger, it cannot be cached separately from the page, and it makes the HTML harder to read. Photos and big graphics are better served as normal image files.
The same logic applies to fonts and SVG. An SVG is already text, so you can often embed it with a plain URL-encoded data URI, which stays smaller than Base64.
Accuracy and limits
Encoding and decoding are exact and reversible. Files are limited to 5 MB, and the Base64 text of a 5 MB file is about 6.7 MB, which can slow older phones. If decoded bytes are not valid UTF-8 text, the tool treats them as binary rather than showing garbled characters. Decoding only reveals what was encoded; it cannot tell you whether the original data was safe, so do not open unknown decoded files.
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding, not encryption. It changes the form of the data but anyone can reverse it without a key, so it gives no protection.
Why does Base64 end with = signs?
The equals signs pad the output to a multiple of four characters when the input length is not a multiple of three bytes. One or two may appear at the end. URL-safe Base64 often leaves them off.
Why is the Base64 version larger than the original?
Every three bytes become four characters, so the text is about 33% longer. Line breaks in email Base64 add a little more.
Can I decode an image from Base64 here?
Yes. If the decoded bytes are not text, the tool offers them as a download. Rename the file to the correct extension, such as .png or .pdf, to open it. A data URI beginning with data:image/png;base64, should have that prefix removed before decoding.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in web addresses. URL-safe Base64 uses - and _ instead, so it can sit inside a link or a filename without extra escaping.