Base64 Encode and Decode online

Simply enter your data then click on the encode button

Drop file here or click to upload

Please, find here the base64 encode result

Decode to Base64 format

How to use our tool to base64 encode ?

You can base64 encode or decode with our application called Encode Base64.

With this straightforward program, you may convert base64 to text or any other form of file.

Here the most common file usecase :

You only need to load the file you wish to encode or copy and paste your data into the field to utilize this program. You can select either a text or a file.

You only need to load a file in order to convert it to base64.

Then all you have to do is press the encode button.

How does base64 work? How can we base64 encode and decode ?

Base64 is a technique for converting 8-bit binary data, such as ZIP files or pictures, into a string of solely readable ASCII characters that is code page independent. It is used to deliver email attachments in the Internet standard Multipurpose Internet Mail Extensions (MIME). Since SMTP was initially only intended to be used for delivering 7-bit ASCII letters, this is essential to ensure the error-free delivery of any binary data. The space need of the data stream is increased by the encoding by 33–36% (33% owing to the encoding itself, and up to an additional 3% due to the line breaks placed in the encoded data stream). For instance, Base64 is also used to send SSH server certificates and to encrypt users and passwords for HTTP basic authentication.

Coding is done using the letters A-Z, a-z, 0-9, +, and /, as well as the sign = at the conclusion. Lossless data transmission between both systems is guaranteed since these characters are also present in the Extended Binary Coded Decimals Interchange Code.

Three bytes of the byte stream are separated into four 6-bit blocks for coding. These 6-bit pieces combine to create a number between 0 and 63. The following conversion table and output transforms these integers into "printable ASCII characters." This fact explains the algorithm's name: Each character in the stream of encoded data can be given a number between 0 and 63. This corresponds to a base 64 number system mathematically.

The text to be encoded is padded at the end with padding bytes made up entirely of zero bits if the total number of input bytes is not divisible by three, resulting in a number of bytes that is divisible by three. The 6-bit blocks composed entirely of padding bytes are encoded with = to inform the decoder how many padding bytes have been inserted. So, no, a Base64-encoded file cannot finish with one or two = signs. In other words, the same number of = signs are added as padding bytes are added.

Some contexts and protocols do not utilize padding because the number of original bytes can always be known with certainty from the quantity of Base64 input characters.

Very long Base64 strings are frequently wrapped when shown, which inserts a line break. Such line breaks are not taken into account during decoding.

Because they are reserved for specific functions in file names and URLs, the characters +, /, and = cannot be used there. In this situation, base64url is used to describe an incompatible variation. If the length of the string is known, the filler character = at the end can be omitted.

Example to convert text to base64 with Javascript

You can find here a simple Javascript function that enables to encode a text (string) to base64 format

// Base64 encode : text to base64 with Javascript

function encodeTextToBase64(string) {

    try {

        return btoa(string);

    } catch (err) {




Example to convert text to base64 with Java

You can find here a simple Java static function that enables to encode a text (string) to base64 format

// Base64 encode : text to base64 with Java

public static String encodeTextToBase64(String string) {

    return Base64.getEncoder().encodeToString(string.getBytes());


Select language