Base64 Encode / Decode
Encode and decode Base64 strings instantly. All processing happens in your browser — nothing is sent to our servers.
File to Base64
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It was originally defined in RFC 4648 and is one of the most common encoding formats on the web.
Base64 is not encryption — it provides no security. Anyone can decode a Base64 string. Its purpose is purely to make binary data safe for text-based transmission channels.
How Base64 Works
The encoding process takes groups of 3 bytes (24 bits) and splits them into 4 groups of 6 bits. Each 6-bit group maps to one of 64 printable ASCII characters: A-Z (26), a-z (26), 0-9 (10), and two symbols + and /. The = character is used for padding when the input length is not divisible by 3.
This means Base64 encoding increases the data size by approximately 33% — every 3 bytes of input become 4 bytes of output. Despite this overhead, Base64 remains essential for scenarios where binary data must pass through text-only systems.
Common Use Cases
- Data URIs — embedding images, fonts, and other assets directly in HTML and CSS without additional HTTP requests
- Email attachments — MIME encoding uses Base64 to attach files to emails via the text-based SMTP protocol
- API data transfer — transmitting binary data (images, PDFs, etc.) in JSON and XML payloads
- Certificates and keys — PEM format stores X.509 certificates and RSA keys as Base64 between BEGIN/END headers
- JWT tokens — JSON Web Tokens use Base64url encoding for their header and payload sections
- Basic Authentication — HTTP Basic Auth encodes credentials as
username:passwordin Base64
Base64 vs Base64url
Standard Base64 uses + and / characters, which have special meaning in URLs. Base64url replaces them with - and _ respectively, and omits padding (=). This variant is used in JWTs, filename-safe strings, and URL parameters.