Understand Base64 encoding for binary data transmission.
Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation.
#
Base64 encoding converts binary data into text using 64 printable characters:
The = character is used for padding.
#
1. Binary data is divided into groups of 3 bytes (24 bits) 2. Each group is divided into 4 chunks of 6 bits 3. Each 6-bit chunk is mapped to a Base64 character 4. If the input isn't divisible by 3, padding is added
#
``
Input: "Hi"
Binary: 01001000 01101001
Groups: 010010 000110 1001xx (padding)
Base64: S G k =
Result: "SGk=" ``
#
1. Embedding images in HTML/CSS 2. Storing binary data in JSON/XML 3. Data URIs 4. Email attachments 5. URL parameters (with URL-safe variant)
#
Standard Base64 uses + and / which are not URL-safe. URL-safe Base64 replaces:
#
Standard Base64:
URL-Safe Base64:
Base64url:
#
Padding is not always required:
#
Base64 is encoding**, not **encryption:
#
#
``html
``
This embeds the image directly in the HTML/CSS file.
Base64 is used to encode binary data into text for transmission over text-based protocols.
No, Base64 is encoding, not encryption. Anyone can decode it.
Base64 encodes 6 bits into 8 bits, resulting in ~33% size increase.
URL-safe Base64 replaces + with - and / with _ to make the output URL-safe.
Padding (=) ensures the output length is divisible by 4. Most decoders work without it.
Use built-in functions like atob() in JavaScript or base64.b64decode() in Python.
Yes, Base64 can encode any binary data into text.
Use Base64 when you need to embed binary data in text formats like JSON, XML, or HTML.
Try our tools to apply what you have learned in real-time.