Base64 Encode Decode

Binary data can be encoded (encoded) or decoded (decoded) with this free tool. Binary data must be encoded in order to be transmitted with textual data.

Upload File

Share on Social Media:

How Does Base64 Work?

The Base64 numeral system uses 64 digits and can be represented with 6 bits.

By translating binary data into radix-64 representation, Base64 is a group of binary-to-text encoding schemes.

For example, Base64 is used to encode binary data in email messages and web pages. It is also used to transmit binary files over channels that are not 8-bit clean, or without worrying about byte order.

Options For Advanced Users

Our site utilizes the UTF-8 character set for data transmission. If you'd like, you can switch this prior to encoding. Please note that the encoding scheme in text doesn't support a character set; hence, you need to specify one during decoding. As for files, binary is the default option and enables the conversion avoidance of plain text files.

Newline separator: Unix and Windows use different line break characters, so the selected option will replace the default one within your data before encoding. For the files section, this is partially irrelevant since files already have the corresponding separators, but you can specify which one to use for the "encode each line separately" and "split lines into chunks" functions.

You can encode each line separately: All newline characters are converted to their Base64-encoded forms.

When you check this option, the encoded data will become a continuous text without any whitespace, so you can use it to break it up into several lines. The applied character limit is defined in the MIME (RFC 2045) specification, which states that the encoded lines must not exceed 76 characters. (*)

It is unnecessary to encode "+", "/" and "=" characters into their percent-encoded form when using standard Base64 in URLs, making the string unnecessarily long. The "+" and "/" characters are replaced by "-" and "_" in this URL- and filename-friendly Base64 variant (RFC 4648 / Base64URL) and padding "=" signs are omitted.

This mode uses your browser's JavaScript functions to encode data immediately, without sending any information to our servers. It currently supports only the UTF-8 character set.

Tool For Encoding and Decoding Base64 (MIME)

Binary data can be encoded (encoded) or decoded (decoded) with this free tool. Binary data must be encoded in order to be transmitted with textual data. For example, an attachment in an email would require it to be encoded using MIME's Base64 implementation. In order to encode data, the MIME implementation uses the characters A-Z, a-z, and 0-9.

The following text, for example:

It's cool to use AutoSeoTools!

It would be encoded as...


Base64 Encoding Details

The Base64 term originates from a specific MIME-content transfer encoding that encodes binary data using a numerical representation and a base-64 representation.

The Design

The choice of characters used for Base64 may differ across implementations. Generally, it should involve a set of 64 characters which are both 1) part of a subset commonly supported by other encodings as well as 2) being printable. This helps prevent unintended modifications while passing through legacy systems, like email, which did not typically support 8-bit data transmission. As an example, MIME's Base64 employs A-Z, a-z and 0-9 for the first 62 values and "+" and "/" as the last two. There are other variations that usually originate from Base64 but vary in terms of selecting symbols for the final two values; one example is "RFC 4648 /Base64URL "which uses "+" and "_".

An example

From Thomas Hobbes' Leviathan, here is a quote:

"Man is distinguished not only by his reason, but also by..."

The following ASCII byte sequence is encoded in MIME's Base64 scheme:


The ASCII code for the letters in "Man" (77, 97, 110) is stored as the binary sequence "010011010110000101101110". This can then be divided into 4 packs of 6 bits; each pack has 64 possible values which when converted to Base64 gives us an encoded value of TWFu.


JavaBase64.encodeBase64(string);Base64.decodeBase64(string);Requires import org.apache.commons.codec.binary.Base64;
JavaScriptbtoa(string);atob(string);<= IE9 is unsupported
RubyBase64.encode64('string')Base64.decode64(enc)Requires require "base64"
Perlencode_base64($string);decode_base64($string);Requires use MIME::Base64;