What Is Base64 Encoding & How Does It Work Under the Hood?
Demystify Base64 binary-to-text encoding. Understand 6-bit chunking, padding characters, URL-safe Base64, and why Base64 is not encryption.
Sponsored Space
- Base64 encodes binary data into 64 safe ASCII characters for seamless network transit.
- Converts 3 bytes (24 bits) into 4 printable ASCII characters (each carrying 6 bits).
- Padding (=) is added when the binary byte stream is not evenly divisible by 3.
- Base64 is an encoding format, NOT encryption — it offers zero data secrecy on its own.
Try the Base64 Encoder
Encode plain text, strings, and UTF-8 data into Base64 format with URL-safe encoding support.
What Is Base64 Encoding? Base64 is a binary-to-text encoding scheme designed to translate arbitrary binary data (such as images, PDF documents, or cryptographic hashes) into a string consisting exclusively of 64 printable ASCII characters.
It ensures that data passes safely through legacy email systems, HTTP headers, and URL parameters without being corrupted or modified by character encoding translations.
The Base64 Character Set (Alphabet)
The 64 characters used in standard Base64 (RFC 4648) are:
- Uppercase Letters (26): A-Z (indices 0 to 25)
- Lowercase Letters (26): a-z (indices 26 to 51)
- Digits (10): 0-9 (indices 52 to 61)
- Special Symbols (2): + (index 62) and / (index 63)
- Padding Character: =
Base64 transforms 3 bytes (24 bits) of raw data into 4 ASCII characters (6 bits each):
1. Read 3 Bytes: Take 3 consecutive input bytes (e.g. string "Man" = ASCII hex 4D 61 6E).
2. Binary Breakdown: 01001101 01100001 01101110 (24 bits total).
3. Partition into 4 Groups of 6 Bits:
- Group 1: 010011 (Decimal 19 ➔ Char T)
- Group 2: 010110 (Decimal 22 ➔ Char W)
- Group 3: 000101 (Decimal 5 ➔ Char F)
- Group 4: 101110 (Decimal 46 ➔ Char u)
4. Encoded Output: "Man" transforms into "TWFu".
Sponsored Space
Understanding Padding (= and ==)
When the total input bytes are not divisible by 3:
- If 1 byte is left over (8 bits), 4 zero bits are appended to create two 6-bit groups, followed by two == padding characters.
- If 2 bytes are left over (16 bits), 2 zero bits are appended to create three 6-bit groups, followed by one = padding character.
Standard Base64 vs. URL-Safe Base64
In standard Base64, the characters + and / have special meanings in web URLs (+ can be parsed as a space, and / as a path separator).
URL-Safe Base64 replaces these characters:
- Replaces + with - (minus)
- Replaces / with _ (underscore)
- Often omits trailing = padding
Encode & Decode Base64 Online - Convert plain text or files to Base64 with our free Base64 Encoder. - Decode Base64 back into original text using our Base64 Decoder.

Written by Software Engineering Desk
Peer-Reviewed & Fact-CheckedCybersecurity & Network Protocols Engineers at Zovli Hub. Formulas and algorithms are mathematically verified against BIPM, ISO, and RFC standards.
Sponsored Space
Frequently Asked Questions
Related Calculation Guides
Explore more tutorials and formula deep dives.
How to Calculate Percentage Easily: Formulas, Shortcuts & Mental Math Examples
Master percentage calculations for shopping discounts, exam scores, sales tax, and business profit margins with simple formulas and instant mental math hacks.
How EMI Calculators Work: Loan Formulas, Interest & Amortization Schedules
Learn the exact mathematics behind Equated Monthly Installments (EMI) for mortgages, auto loans, and personal loans, and discover how to minimize your total interest.
How to Calculate Your Exact Age in Years, Months, Days & Hours
Understand how calendar systems, varying month lengths, and leap years affect chronological age calculation, and learn how to determine your precise biological age.