Base64 Encoding Explained: How to Encode & Decode Online
A clear guide to Base64 encoding — what it is, why it exists, and how to encode or decode text and files online for free.
What is Base64?
Base64 is an encoding scheme that converts binary data into a set of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). The name comes from the 64-character alphabet used. It was designed to safely transmit binary data through text-only channels — such as email (MIME) and HTTP headers — that can't handle raw binary bytes.
Why Does Base64 Exist?
Many protocols and systems were designed to handle only text. Sending an image or a PDF directly through such systems risks data corruption. Base64 solves this by representing binary data using only safe ASCII characters. Key use cases include:
- Email attachments — MIME encoding uses Base64 for file attachments
- Data URLs — embedding images in CSS/HTML as
data:image/png;base64,... - API tokens — Basic Auth credentials are Base64-encoded in HTTP headers
- JWT tokens — the header and payload sections are Base64URL-encoded
- Storing binary in JSON — since JSON is text, binary fields are Base64-encoded
How Does Base64 Encoding Work?
Base64 works by taking 3 bytes (24 bits) of binary data and splitting them into 4 groups of 6 bits. Each 6-bit group maps to one of the 64 characters in the alphabet. This means Base64 output is always about 33% larger than the original data — 3 bytes become 4 characters.
If the input length isn't divisible by 3, padding characters (= or ==) are added to reach a multiple of 4.
Base64 vs Base64URL
Standard Base64 uses + and / which are special characters in URLs. Base64URL replaces these with - and _ to make the output URL-safe. JWT tokens use Base64URL encoding.
Is Base64 Encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it instantly. Never use Base64 to hide sensitive data — use proper encryption algorithms like AES-256 instead. Base64 simply changes the representation of data, not its security.
How to Encode & Decode Base64 Online
- Open the ToolsPal Base64 Encoder
- Paste your text or upload a file in the input panel
- The Base64-encoded output appears instantly
- Switch to Decode to convert Base64 back to plain text
Free Online Tool
Try Base64 Encoder/Decoder
Encode or decode Base64 strings and files instantly.