Free Online Base64 Encoder & Decoder
Encode text into Base64 or decode Base64 strings instantly. A simple, browser-based utility for developers.
Input Text
Enter text or paste a Base64 string to process.
Output Result
Your encoded or decoded result will appear here.
About the Base64 Encoder & Decoder
Convert text to Base64 and decode Base64 strings with a straightforward online developer tool.
What is Base64 encoding?
Base64 is a method of representing binary data using a set of ASCII characters. It is often used when data needs to be represented as text, such as in APIs, email attachments, and data URLs.
How to use the Base64 Encoder and Decoder
- Enter your text or Base64 string in the input box.
- Click Encode to convert the input to Base64.
- Click Decode to convert Base64 back to its original representation.
- Copy the result or download it as a TXT file.
How Base64 works: a worked example
Base64 takes the input bytes three at a time (24 bits) and splits them
into four groups of 6 bits. Each 6-bit value (0–63) is mapped to one
character of the alphabet A–Z, a–z,
0–9, + and /. Encoding the text
Hi!:
| Characters | H | i | ! | |
|---|---|---|---|---|
| Bytes | 01001000 | 01101001 | 00100001 | |
| 6-bit groups | 010010 | 000110 | 100100 | 100001 |
| Values | 18 | 6 | 36 | 33 |
| Base64 | S | G | k | h |
So Hi! encodes to SGkh.
What the = padding means
When the input length isn't a multiple of three, the last group is
incomplete and the output is padded with = so its length is a
multiple of four:
Hi!(3 bytes) →SGkh(no padding)Hi(2 bytes) →SGk=(one=)H(1 byte) →SA==(two=)
Size overhead
Every 3 bytes become 4 characters, so Base64 output is about
33% larger than the original data. A 300 KB image becomes
about 400 KB of Base64 text. That's why embedding large images as
data: URLs in HTML or CSS usually makes pages slower. Base64
is best for small icons or when a text-only channel leaves no other
choice.
Unicode text and UTF-8
Base64 encodes bytes, not characters, so text has to be converted to bytes
first. This tool uses UTF-8, the encoding used by almost every web API. For
example, café encodes to Y2Fmw6k=, because
é takes two bytes in UTF-8. If a Base64 string was created from
a different character encoding, such as Windows-1252, decoding it as UTF-8
may show garbled characters.
Base64 vs. Base64URL
Standard Base64 uses + and /, which have special
meanings in URLs. The URL-safe variant (Base64URL), used by JSON Web Tokens
(JWT), replaces them with - and _ and often drops
the = padding. This tool works with standard Base64. To decode
a Base64URL value, first replace - with + and
_ with /. Missing = padding is
accepted.
Common uses of Base64
- HTTP Basic authentication: the
Authorization: Basic …header containsusername:passwordencoded in Base64. It is encoded, not encrypted, so it must only be sent over HTTPS. - Data URLs: small images or fonts embedded directly in HTML or CSS, for example
data:image/png;base64,…. - Email attachments: MIME encodes binary attachments as Base64 so they can travel through text-only mail systems.
- JSON APIs: JSON has no binary type, so files and byte arrays are often sent as Base64 strings.
- JWTs: the header and payload of a JSON Web Token are Base64URL-encoded JSON.
Is Base64 secure?
Base64 is an encoding format, not a security mechanism. It does not encrypt or password-protect your data. Use appropriate encryption and secure transport when protecting sensitive information.
Frequently Asked Questions
Base64 encoding converts binary or text data into an ASCII string format using a specific character set. It is commonly used to safely transmit data through systems that only support text.
Base64 encoding is not encryption. It only changes data into a readable text format for safe transmission, while encryption protects data using a key and makes it unreadable without decryption.
No. Base64 encoding is not encryption. It only converts data into a different format. Anyone can decode Base64 back to its original form.
Base64 is widely used in web development, APIs, email attachments, and embedding images in HTML or CSS.
Paste the Base64 encoded text into the input field and click the Decode button. The original text will appear in the output area.
You can upload a text file, such as .txt, .json or .csv. Its contents are loaded into the input box, and you can then encode them. Binary files such as images or PDFs are read as text and won't encode correctly, so use a dedicated file-to-Base64 tool for those.
The input contains characters that aren't part of standard Base64, or its length is wrong. Common causes are URL-safe Base64 (with - and _ instead of + and /), a data: URL prefix such as data:image/png;base64, that hasn't been removed, or a string that was cut off when copying.