CoShareX Logo
HomeBlogUtilitiesWhat Is Base64 Encoding and How Does It Work?
Utilities

What Is Base64 Encoding and How Does It Work?

Published 2026-08-20
4 min read
By CoShareX

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It is widely used to transfer binary files (like images) over media that are designed to handle text.

How the Base64 Algorithm Works

Base64 encoding works by dividing every 3 bytes (24 bits) of binary data input into 4 groups of 6 bits each:

  1. Take 3 bytes (e.g. ABC -> ASCII 01000001 01000010 01000011).
  2. Split into 4 groups of 6 bits:
  • 010000 (16)
  • 010100 (20)
  • 001001 (9)
  • 000011 (3)
  1. Map each index to the standard Base64 character alphabet:

A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), / (63).

  • Index 16 maps to Q
  • Index 20 maps to U
  • Index 9 maps to J
  • Index 3 maps to D
  1. Result for ABC is QUJD.
Featured Tool

Base64 Encoder / Decoder

Encode plain text to Base64 format or decode Base64 back to plain text.

Padding with =

If the input length is not a multiple of 3, Base64 adds zero bits to complete the last 6-bit group and appends one or two = padding characters to the end of the encoded string, indicating skipped bytes.