Free Base64 Encoder and Decoder Online
Convert text and files to Base64 encoding or decode Base64 strings back to original format with our free online tool. Supports standard Base64 and URL-safe Base64 encoding schemes. Encode text, JSON, XML, or binary files. Decode Base64 strings to readable text or downloadable files. Perfect for developers working with APIs, data URLs, authentication headers, email attachments. Instant results with copy and download options. No registration required, all processing happens securely in your browser.
Understanding Base64 Encoding
What is Base64? Base64 is a binary-to-text encoding scheme that converts binary data into ASCII string format using 64 printable characters. These 64 characters are: A-Z uppercase letters, a-z lowercase letters, 0-9 digits, plus two additional characters (typically + and / for standard Base64, or - and _ for URL-safe variant). The encoding represents three bytes of binary data as four ASCII characters, increasing data size by approximately 33%.
How Base64 Works: The encoding process divides input data into groups of three bytes (24 bits). Each 24-bit group is then divided into four 6-bit groups. Each 6-bit value (0-63) maps to one of the 64 Base64 characters. If input data length is not divisible by three, padding characters (=) are added to make the output length divisible by four. This ensures proper decoding.
Standard vs URL-Safe Base64: Standard Base64 uses + and / as the 62nd and 63rd characters. URL-safe Base64 replaces these with - and _ because + and / have special meanings in URLs. URL-safe variant is commonly used in web applications, file names, JWT tokens, and URL parameters where standard Base64 characters would cause issues.
Common Use Cases
API Authentication: Many APIs use Base64-encoded credentials in HTTP Authorization headers. Basic authentication scheme encodes username:password in Base64. Example: Authorization header contains "Basic" followed by Base64-encoded credentials. This is standard practice but should only be used over HTTPS since Base64 is not encryption.
Data URLs: Embed images, fonts, or other files directly in HTML, CSS, or JavaScript using data URLs. Format: data:mime-type;base64,encoded-data. Example: small images can be embedded as Base64 in CSS to reduce HTTP requests. Useful for icons, logos, and small graphics in web applications.
Email Attachments: SMTP email protocol uses Base64 encoding for email attachments in MIME format. Binary files are encoded to Base64 for safe transmission through email systems that were originally designed for text-only content. Ensures binary data survives email transfer without corruption.
JSON and XML Data: Store binary data like images or files in JSON or XML documents. JSON and XML are text-based formats that cannot directly contain binary data. Base64 encoding allows binary data to be represented as text strings within these formats. Common in REST APIs and configuration files.
How to Use Base64 Tool
Select encode or decode mode. Choose text or file input type. For text: paste or type text in input area. For files: drag and drop file or click to upload. Select URL-safe option if encoding for URLs or filenames. Choose line break option for formatted output if needed. Click convert button to process. Copy result to clipboard or download as file. For decoding: paste Base64 string and click decode to get original content. Tool automatically handles padding and validates Base64 format.
Base64 vs Encryption
Important Distinction: Base64 is encoding, not encryption. Encoding transforms data format for transmission or storage compatibility. Encryption transforms data to prevent unauthorized access. Base64-encoded data can be easily decoded by anyone. Never use Base64 alone for security or confidentiality. Combine with proper encryption (AES, RSA) when security is required. Base64 is for data representation, not data protection.
Technical Details
Character Set: Standard Base64 uses A-Z (26 chars), a-z (26 chars), 0-9 (10 chars), + and / (2 chars) = 64 total characters. Padding character = is used when needed. URL-safe Base64 replaces + with - and / with _ for URL compatibility.
Size Increase: Base64 encoding increases data size by approximately 33%. Three bytes of binary data become four Base64 characters. Example: 100 bytes of binary data becomes roughly 133 bytes when Base64-encoded. Consider this overhead when encoding large files or using data URLs.
Line Breaks: MIME specification suggests adding line breaks every 76 characters in Base64-encoded data for email compatibility. Some systems require these breaks, others do not. Our tool provides option to include or exclude line breaks based on your needs.
Start Encoding and Decoding Now!
Use the tool above to encode text and files to Base64 or decode Base64 strings instantly!