XhCode Online Converter Tools
50%

Base64 Encode


Enter the text to Base64 Encode

Size : 0 , 0 Characters

The Base64 Encoded:

Size : 0 , 0 Characters
Base64 Encode tool

To Base64 encode data, we convert binary data (like text, images, or files) into a textual representation using the Base64 encoding scheme. It encodes the data using an alphabet of 64 characters, which includes uppercase letters, lowercase letters, digits, and the symbols + and / (or - and _ for URL-safe encoding).

If you would like to Base64 encode a string, here's the basic process:

How Base64 Encoding Works:
Input Data: You provide the data you want to encode (usually in the form of a string or file).
Convert to Binary: The data is first converted into binary (usually bytes).
Group the Binary into 6-bit Chunks: The binary data is divided into chunks of 6 bits (since 2^6 = 64).
Map Each 6-bit Chunk to a Base64 Character: Each 6-bit group is mapped to one of the 64 characters in the Base64 alphabet.
Add Padding if Necessary: If the input data isn't a multiple of 3 bytes (24 bits), padding is added using = to ensure the output is a multiple of 4 characters.
Base64 Alphabet:
The Base64 alphabet is as follows:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Example of Base64 Encoding:
Let's say you want to encode the string "hello":

Convert "hello" into its binary representation.
Break the binary data into 6-bit chunks.
Map those chunks to Base64 characters.
Here's how the string "hello" would be encoded:

Original string: "hello"
Binary Representation: 01101000 01100101 01101100 01101100 01101111
Divided into 6-bit chunks: 011010 000110 010101 101100 011011 000110 1111
Mapped to Base64: aGVsbG8=
Base64-encoded output: "aGVsbG8="