Base64 Encryption

Here is base64 online generator that turn binary data into text (encode) or text into binary (decode).

The base64_encode() function is an inbuilt PHP function which is used to convert any data to base64 encoding.

Why do we need base64 encoding?

When you have some binary data that you want to ship across a network, you generally don't do it by just streaming the bits and bytes. Because some media are made for streaming text. You never know -- some protocols may interpret your binary data as control characters (like a modem), or your binary data could be screwed up.

So to get around this, people encode the binary data into characters. Base64 is one of these types of encodings.

Syntax

The syntax for the Base64 Encode is following.

base64 Encode Syntax

Parameters

  • data: Required. It specifies the data to be encode.

Example

Base64 encoded data takes about 33% more space than the original data.

Let's see the following example for Base64 encode

base64 Encode Example

The above example will give output

base64 Encode Output