What is Base64?
Base64 is an encoding scheme that converts binary data into ASCII text. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent data.
Why Does Base64 Exist?
Many systems (email, URLs, JSON) only support text. Base64 lets you embed binary data (images, files) in text-only formats.
Common Use Cases
|----------|---------|
How Base64 Works
Original text: Hello
Binary: 01001000 01100101 01101100 01101100 01101111
Base64: SGVsbG8=
The = at the end is padding to make the output length a multiple of 4.
Size Impact
Base64 increases data size by approximately 33%. A 1MB image becomes ~1.33MB in Base64.
Practical Examples
Embedding an Image in HTML

Basic Auth Header
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Storing Data in JSON
{
"file": "SGVsbG8gV29ybGQ=",
"type": "text/plain"
}