Base64 Encode/Decode
Encode text to Base64 or decode Base64 strings back to plain text. Fully supports UTF-8 characters.
What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into 64 printable ASCII characters. It is widely used in email attachments, web data URIs, API authentication, and anywhere binary data must be safely transmitted over text-based protocols. This tool processes everything in your browser — no data is ever sent to a server.
Base64 Tips
- Base64 is NOT encryption. Never use it to protect sensitive data — use proper encryption instead.
- Base64 encoding increases data size by ~33%. Be mindful when encoding large files.
- When using Base64 in URLs, consider the URL-safe variant (replacing + and / with - and _).
- JWT tokens are Base64URL-encoded JSON data. You can decode the payload with this tool to inspect claims.
- Embedding images as Base64 data URIs in CSS/HTML reduces HTTP requests but increases file size.
Complete Guide to Base64 Encoding
The Base64 Encode/Decode tool instantly converts between plain text and Base64-encoded strings, completely free and online. All processing happens exclusively in your browser — no data is ever transmitted to a server, ensuring complete privacy. With full UTF-8 support, you can encode and decode any Unicode characters including CJK scripts, emojis, and special symbols. This is an essential everyday tool for developers, system administrators, and data engineers.
Key Features
- Full UTF-8 support — handles all Unicode characters including CJK, emojis, and special symbols
- Bidirectional conversion — both encoding and decoding in one tool
- Browser-only processing — your data never leaves your device
- Instant conversion — get results with a single click
- One-click copy — copy the result to your clipboard instantly
Why Base64 Encoding Matters
Base64 plays a critical role in modern web development and data communication. Text-based protocols (HTTP, SMTP, JSON, etc.) cannot handle raw binary data directly, so Base64 encoding is essential for safely transmitting images, files, and authentication credentials.
- Email Attachments (MIME): The SMTP email protocol is 7-bit ASCII based, so binary attachments like images and documents are Base64-encoded for transmission. Every email client uses this method.
- Data URIs (Data URLs): You can embed images directly in HTML or CSS using the
data:image/png;base64,...format. This reduces HTTP requests and can improve page loading speed for small assets. - API Authentication (Basic Auth): HTTP Basic Authentication encodes
username:passwordin Base64 and sends it in theAuthorization: Basic ...header. - JWT Tokens: JSON Web Tokens encode their header and payload in Base64URL. You can decode the payload to inspect token contents without verifying the signature.
- Binary Data in JSON/XML: When text-based data formats need to include binary data like images or files, Base64 encoding is the standard approach.
How Base64 Encoding Works
Base64 works by splitting input data into 6-bit groups and mapping each group to one of 64 characters.
- Character Set: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), / (63) — a total of 64 characters.
- Conversion Process: Every 3 bytes (24 bits) of input are split into four 6-bit groups, and each group is mapped to its corresponding Base64 character.
- Padding: When the input length is not a multiple of 3, the remaining bits are padded with zeros and = characters are appended to the output. A 1-byte remainder produces ==, and a 2-byte remainder produces =.
- Example: "Hi" → binary 01001000 01101001 → 6-bit groups 010010 000110 1001(00) → Base64 "SGk="
Base64 Variants
Several Base64 variants exist for different use cases.
- Standard Base64 (RFC 4648): Uses A-Z, a-z, 0-9, +, / characters with = padding. The most common format, used in email, MIME, and general-purpose encoding.
- Base64URL (RFC 4648 §5): Replaces + with - and / with _ for URL and filename safety. Used in JWT tokens and URL query parameters. Padding (=) is often omitted.
- MIME Base64 (RFC 2045): Uses the same characters as standard Base64 but inserts line breaks (CRLF) every 76 characters. Used in email messages to ensure compatibility with older mail servers.
Real-World Use Cases
- Embedding images in CSS: background-image: url('data:image/png;base64,iVBOR...') — ideal for small icons and logos, reducing HTTP requests for better performance.
- Storing binary data in JSON: {"image": "iVBORw0KGgo..."} — used when REST API responses include image or file data.
- HTTP Basic Auth header: Authorization: Basic dXNlcjpwYXNz — Base64-encodes username:password for API authentication.
- Debugging JWT tokens: Decoding eyJhbGciOiJIUzI1NiJ9 yields {"alg":"HS256"} — useful for inspecting token payloads.
- Email attachment processing: MIME Content-Transfer-Encoding: base64 — all email attachments are encoded this way.
Size Considerations
Base64 encoding increases the original data size by approximately 33%. This is because 3 bytes of input become 4 bytes of output (4/3 ≈ 1.33). MIME Base64 adds line break characters, resulting in approximately 36-37% increase.
For large files (several MB or more), Base64 can waste significant memory and bandwidth. In those cases, consider multipart uploads or binary transfer methods instead. Base64 is best suited for small data like icons, configuration values, and authentication tokens.
For large files (several MB or more), Base64 can waste significant memory and bandwidth. In those cases, consider multipart uploads or binary transfer methods instead. Base64 is best suited for small data like icons, configuration values, and authentication tokens.
Security Notice
Base64 is encoding, NOT encryption. Anyone can instantly decode Base64-encoded data.
- Never rely on Base64 alone to protect passwords, API keys, or personal information.
- Always use HTTP Basic Auth over HTTPS. Base64-encoded credentials can be easily intercepted on the network.
- JWT token payloads are Base64URL-encoded and readable by anyone. Never include sensitive information in the payload.
- For actual security, use proper encryption/hashing algorithms like AES-256, RSA, or bcrypt.
Frequently Asked Questions
Base64 is an encoding scheme that converts binary data into text using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to transmit binary data over text-based protocols like HTTP, SMTP, and JSON, where raw binary is not supported.
No. Base64 is encoding, not encryption. Anyone can easily decode a Base64 string without any key or secret. Never use Base64 to protect passwords, API keys, or personal information. Use proper encryption algorithms like AES-256 or RSA for security.
Yes, this tool fully supports UTF-8, so you can encode and decode any Unicode characters including CJK characters, emojis, and more. The text is first converted to UTF-8 bytes, then those bytes are Base64-encoded.
Base64 encoding increases data size by approximately 33%. Every 3 bytes (24 bits) of input produces 4 Base64 characters (each representing 6 bits). For example, a 1MB file becomes approximately 1.33MB when Base64-encoded.
Standard Base64 uses + and / characters, while Base64URL replaces them with - and _ to be safe for URLs and filenames. Base64URL also often omits the padding character (=). JWT tokens and URL query parameters use Base64URL encoding.