Encode text or files to Base64, or decode Base64 strings instantly. All processing happens in your browser.
Drag and drop a file here, or browse
Any file type supported
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 ASCII characters. It was designed to allow binary data to be transmitted over channels that only reliably support text content, such as email protocols and HTML documents.
The Base64 alphabet consists of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two additional characters (+ and /). The = character is used for padding when the input length is not divisible by 3.
The encoding process takes every 3 bytes (24 bits) of input data and splits them into four groups of 6 bits each. Each 6-bit group is then mapped to one of the 64 characters in the Base64 alphabet. This is why Base64-encoded data is approximately 33% larger than the original.
Original: M a n
ASCII: 77 97 110
Binary: 01001101 01100001 01101110
6-bit groups: 010011 010110 000101 101110
Base64: T W F u
If the input data is not a multiple of 3 bytes, padding characters (=) are appended to the output to make the total length a multiple of 4.
data: URIs, eliminating extra HTTP requests.username:password in Base64 before being sent in the Authorization header.Data URIs allow you to embed resources directly in your code. This can reduce HTTP requests and improve page load performance for small assets like icons and simple graphics.
<!-- Embedding an image in HTML -->
<img src="data:image/png;base64,iVBORw0KGgo..." alt="icon">
/* Embedding a background image in CSS */
.icon {
background-image: url('data:image/svg+xml;base64,PHN2Zy...');
}
While data URIs are convenient, they do increase the size of your HTML/CSS files by about 33%. They are best used for small assets under 5-10 KB. For larger files, separate HTTP requests with proper caching are more efficient.
When accessing a protected API endpoint using Basic Authentication, the credentials are Base64-encoded and included in the request header:
// JavaScript example
const credentials = btoa('username:password');
fetch('https://api.example.com/data', {
headers: {
'Authorization': 'Basic ' + credentials
}
});
Note that Base64 encoding is not encryption. Basic Authentication should always be used over HTTPS to protect credentials in transit.
Email protocols were originally designed for 7-bit ASCII text. To send binary attachments, MIME uses Base64 encoding with lines split at 76 characters. The Content-Transfer-Encoding header indicates Base64 is used:
Content-Type: image/png; name="photo.png"
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk
+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
No. Base64 is an encoding scheme, not encryption. It transforms binary data into ASCII text for safe transport, but it provides no security. Anyone can decode Base64 data without a key. For security, use proper encryption algorithms like AES or RSA.
Base64 encoding increases data size by approximately 33%. This is because it converts every 3 bytes of binary data into 4 ASCII characters. The trade-off is that the resulting data is safe to transmit through text-based protocols that may not handle binary data correctly.
Yes. All encoding and decoding happens entirely in your browser using JavaScript. No data is ever sent to any server. You can verify this by disconnecting from the internet and using the tool offline - it will continue to work normally.
Since all processing happens in your browser, the maximum file size depends on your device's available memory. Most modern devices can handle files up to 50-100 MB without issues. For very large files, consider using a command-line tool like base64 on Linux/macOS or certutil on Windows.
This tool supports UTF-8 (default and recommended), ASCII, ISO-8859-1 (Latin-1), and Windows-1252. UTF-8 is the most widely used encoding on the web and can represent virtually all characters from all writing systems.
Yes. When you decode a Base64 string that contains image data (with a data URI prefix like data:image/png;base64,), the tool automatically detects it and displays an image preview below the output area. You can also paste raw Base64 image data without the prefix.