Base64 Encode / Decode
Encode text to Base64 or decode Base64 strings back to plain text.
How to Use the Base64 Tool
Type or paste your text into the input field, then click "Encode to Base64" to convert it. To decode, paste a Base64 string and click "Decode from Base64." Use the "Swap" button to move the output back into the input for further operations, and "Copy Output" to copy the result.
What Is Base64?
Base64 is a group of binary-to-text encoding schemes that represent binary data using a set of 64 ASCII characters. The standard Base64 alphabet consists of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), plus (+), and forward slash (/). The equals sign (=) is used for padding.
The encoding process takes groups of 3 bytes (24 bits) from the input and divides them into four 6-bit groups. Each 6-bit group maps to one of the 64 characters in the alphabet, producing 4 output characters for every 3 input bytes.
Common Uses for Base64
Data URIs in Web Development
Base64 allows embedding images, fonts, and other binary files directly in HTML and CSS using data URIs. This eliminates extra HTTP requests and can improve page load performance for small files. For example, a small icon can be embedded as a Base64 data URI in a CSS background-image property.
Email Attachments (MIME)
Email protocols (SMTP) were originally designed for plain text. MIME (Multipurpose Internet Mail Extensions) uses Base64 to encode binary attachments like images and documents so they can be safely transmitted through email systems.
API Data Transmission
When APIs need to transmit binary data within JSON or XML payloads, Base64 encoding ensures the data remains intact. This is common for image uploads, file transfers, and cryptographic signatures.
Authentication
HTTP Basic Authentication encodes the username and password in Base64 format. While this is not encryption, it packages the credentials in a format suitable for HTTP headers.
Base64 vs. Other Encoding Schemes
- Base64 vs. URL Encoding: URL encoding replaces unsafe characters with percent-encoded equivalents. Base64 encodes entire binary data into text. They serve different purposes.
- Base64 vs. Hex: Hexadecimal encoding represents each byte as two hex characters, resulting in a 100% size increase. Base64 is more efficient at approximately 33%.
- Base64URL: A URL-safe variant that replaces + with - and / with _, avoiding issues in URLs and filenames.
Tips for Working with Base64
- Base64 is not encryption — never use it to protect sensitive data.
- For web images, only use Base64 data URIs for small files (under 10KB). Larger images are better served as separate files.
- If your Base64 string does not decode properly, check for extra whitespace or line breaks that may have been introduced during copying.
- Use Base64URL encoding when the output will be used in URLs or filenames to avoid character conflicts.
Frequently Asked Questions
What is Base64 encoding?
Why is Base64 used?
Does Base64 encrypt data?
Why does Base64 make data larger?
Is my data safe?
Related Tools
Word Counter
Count words, characters, sentences, paragraphs, and estimate reading time from any text.
JSON Formatter
Format, validate, and prettify JSON data with syntax highlighting and error detection.
URL Encode/Decode
Encode or decode URLs and query strings for safe transmission and debugging.
Case Converter
Convert text to UPPERCASE, lowercase, Title Case, camelCase, snake_case, and more.