What Is Base64?
Base64 is an encoding scheme that converts binary data into a text format using a set of 64 characters: the 26 uppercase letters (A-Z), 26 lowercase letters (a-z), 10 digits (0-9), plus + and /. An = sign is used for padding at the end.
The name comes from the fact that it uses a base-64 number system — similar to how binary uses base-2 and decimal uses base-10.
Try it instantly with our free Base64 Encoder and Decoder.
Why Does Base64 Exist?
Many systems — email servers, HTML, JSON, HTTP headers — were designed to handle text, not raw binary data. When you need to transmit an image, audio file, or executable program through a text-only channel, you need to convert it to text first. Base64 is the standard way to do this.
Common Uses of Base64
- Email attachments — The MIME standard uses Base64 to encode email attachments. Every PDF you receive by email has been Base64-encoded at some point in its journey.
- Data URIs — Embedding images directly in HTML or CSS without a separate file:
src="data:image/png;base64,iVBORw0KGgo..." - API authentication — Basic authentication encodes credentials as Base64:
Authorization: Basic dXNlcjpwYXNzd29yZA== - JWT tokens — JSON Web Tokens use Base64URL encoding for their header and payload sections.
- Storing binary data in JSON — JSON cannot contain raw binary, so images and files are Base64-encoded before being included in API responses.
- Cookie values — Complex data structures are often Base64-encoded before being stored in cookies.
Base64 Is NOT Encryption
This is the most important thing to understand about Base64: it is not encryption. Anyone can decode a Base64 string without any key or password. It provides zero security. It is purely a way of representing binary data as text.
Never use Base64 to "hide" passwords, API keys, or sensitive information. Use proper encryption (AES, RSA) for that purpose.
How Does Base64 Encoding Work?
Base64 works by taking every three bytes (24 bits) of input and splitting them into four groups of six bits each. Each six-bit group maps to a character in the Base64 alphabet. This is why Base64-encoded data is always about 33% larger than the original — four characters represent three bytes.
If the input length is not a multiple of three, = padding characters are added to complete the last group.
URL-Safe Base64
Standard Base64 uses the + and / characters which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ so the encoded string can be safely included in URLs, filenames, and form data without encoding issues.
Encode and Decode Base64 Online
Our Base64 Encoder and Decoder runs entirely in your browser — nothing is sent to our servers. It supports text encoding, URL-safe output, and file encoding. Simply paste your text or upload a file and get the result instantly.
Related Developer Tools
- Hash Generator — MD5, SHA-256, SHA-512 and HMAC
- HTTP Headers Checker — Inspect request and response headers
- Disposable Email Checker — Detect throwaway email addresses