Skip to content

Base64 Encoder

Convert text and UTF-8 content to Base64 encoded strings

0 characters 0 bytes (UTF-8)

Encoding Options

Quick Examples

Base64 Character Set

Standard Base64

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

Padding: = (equals sign)

URL-Safe Base64

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_

Safe for URLs and filenames

Common Use Cases

HTTP Basic Auth

Encode username:password for Authorization headers

Data URIs

Embed images inline in HTML/CSS

JSON/XML Data

Store binary data in text-based formats

Email Attachments

MIME encoding for email content

Professional Base64 Encoding for Web Development and APIs

Base64 encoding transforms binary data and text into ASCII strings safe for transmission through text-only channels. Our free online Base64 encoder handles all encoding scenarios from simple strings to complex Unicode content, providing essential functionality for API authentication, data embedding, and cross-platform data exchange. Whether implementing HTTP Basic Auth, creating data URIs, or encoding content for JSON payloads, instant Base64 encoding accelerates development workflows.

How Base64 Encoding Works

Base64 divides input data into groups of three bytes (24 bits), then splits each group into four 6-bit values. Each 6-bit value (0-63) maps to one of 64 printable ASCII characters. When input length isn't divisible by three, padding characters (=) fill the remaining positions. This systematic approach guarantees that any binary sequence produces valid ASCII output that survives transmission through restrictive text protocols.

Standard vs URL-Safe Base64

Standard Base64 uses + and / as its 62nd and 63rd characters, inherited from MIME specifications. However, these characters have special meanings in URLs (+ can mean space, / separates path segments). URL-safe Base64 substitutes - and _ which have no special URL significance. Choose URL-safe when embedding encoded data in URLs, query parameters, or filenames. Standard Base64 remains appropriate for headers, JSON values, and general data storage.

UTF-8 and Unicode Handling

Modern text encoding requires proper Unicode support. Before Base64 encoding, text converts to UTF-8 byte sequences. ASCII characters use one byte each, while international characters and emoji may use two to four bytes. This expansion occurs before Base64's 33% overhead, so a single Chinese character (3 UTF-8 bytes) becomes 4 Base64 characters. Understanding this relationship helps estimate output sizes and debug encoding issues.

HTTP Basic Authentication

HTTP Basic Auth requires credentials formatted as"username:password" then Base64 encoded. The resulting string appears in the Authorization header as"Basic [encoded-credentials]". While Base64 provides no security (credentials decode trivially), it ensures special characters in passwords transmit correctly through HTTP headers. Always use HTTPS with Basic Auth since the encoding is not encryption.

Data URIs and Inline Content

Data URIs embed file content directly in HTML or CSS using the format"data:[mediatype];base64,[data]". Small images, fonts, or other assets become self-contained within documents, eliminating additional HTTP requests. This technique improves performance for small files but increases document size due to Base64 overhead. Balance between inline embedding and external files based on asset size and caching requirements.

Line Breaks and MIME Compliance

MIME specifications for email require Base64 content wrapped at 76 characters per line. The line breaks option formats output for email attachments and systems expecting MIME-compliant encoding. Modern applications typically use unwrapped Base64, but legacy email systems and certain APIs may require line-wrapped format. Check your target system's requirements when choosing formatting options.

$ faq

What does Base64 encoding do?
Base64 encoding converts binary data or text into a string of ASCII characters using 64 printable characters (A-Z, a-z, 0-9, +, /). This allows binary data to be safely transmitted through text-based systems like email, JSON, XML, or URLs that might otherwise corrupt binary content.
Why is Base64 encoding used?
Base64 is essential for embedding binary data in text formats, HTTP Basic authentication headers, data URIs for inline images, email attachments (MIME), storing binary in JSON/XML, and transmitting data through systems that only support ASCII text. It ensures data integrity across different platforms and protocols.
How much larger does Base64 make data?
Base64 encoding increases data size by approximately 33%. Every 3 bytes of input become 4 bytes of output. For example, 300 bytes of data becomes 400 Base64 characters. This overhead is the tradeoff for safe text-based transmission of binary data.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / characters which have special meanings in URLs. URL-safe Base64 replaces these with - and _ respectively, making the output safe for use in URLs and filenames without additional encoding. Some systems also omit the = padding characters.
How does Base64 handle Unicode and UTF-8?
Text is first converted to UTF-8 bytes, then those bytes are Base64 encoded. A single emoji or Chinese character may produce multiple UTF-8 bytes, resulting in longer Base64 output. The decoder must know to interpret the result as UTF-8 to correctly restore Unicode characters.
Is Base64 encoding the same as encryption?
No, Base64 is encoding, not encryption. It provides no security - anyone can decode Base64 instantly. It transforms data format for compatibility, not confidentiality. Never use Base64 alone to protect sensitive data. For security, use proper encryption before Base64 encoding if needed.
Is my text data kept private?
Yes, all Base64 encoding happens entirely in your browser using JavaScript. Your text is never uploaded to any server, stored, or transmitted externally. Once you close the page, all data is immediately cleared from memory, ensuring complete privacy for sensitive content like API keys or credentials.