raatools/

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 strings instantly.

Or encode a file:

What is Base64 encoding?

Base64 is an encoding scheme that converts binary data into a text-based format using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). This allows binary data like images, files, and encrypted content to be safely transmitted through text-based systems like email, JSON, XML, and HTML that do not handle raw binary data well.

The encoding works by taking every 3 bytes (24 bits) of input and splitting them into 4 groups of 6 bits each. Each 6-bit group maps to one of the 64 characters. This means Base64-encoded data is about 33% larger than the original binary data. Despite the size increase, the encoding is essential for embedding binary data in text-based contexts.

How to use this tool

To encode: paste text or upload a file. The tool generates the Base64-encoded string. To decode: paste a Base64 string and the tool reveals the original content. The tool handles both text and binary file encoding/decoding. Results can be copied to clipboard or downloaded.

Common uses of Base64

  • Data URIs โ€” embedding small images directly in HTML or CSS (data:image/png;base64,...).
  • Email attachments โ€” MIME encoding uses Base64 to attach files to emails.
  • API communication โ€” sending binary data in JSON request/response bodies.
  • Basic HTTP authentication โ€” credentials are Base64-encoded (not encrypted) in the Authorization header.

Base64 is not encryption

Base64 is an encoding, not an encryption scheme. It provides zero security โ€” anyone can decode Base64 data instantly. It is designed for data transport, not confidentiality. Never use Base64 alone to protect sensitive information. HTTP Basic Authentication sends Base64-encoded credentials, which is why HTTPS is essential โ€” the encryption comes from TLS, not from Base64.

Frequently asked questions

Why does Base64 increase file size by 33%?

Base64 uses 4 characters to represent every 3 bytes of data (4/3 = 1.33, or 33% overhead). This is because each Base64 character encodes only 6 bits, while each byte is 8 bits. Three bytes (24 bits) require exactly four Base64 characters (4 times 6 = 24 bits). The padding character (=) at the end handles cases where the input length is not a multiple of 3.

Should I use Base64 data URIs for images on my website?

Only for very small images (under 2-3 KB, like icons). Base64 data URIs eliminate a separate HTTP request but increase the HTML/CSS file size by 33% and cannot be cached independently. For most images, a separate file served with proper caching headers is more efficient. Modern HTTP/2 reduces the overhead of multiple requests, making data URIs even less necessary.