Encode text to Base64 or decode Base64 strings back to text. Perfect for API testing, data encoding, and web development tasks.
No output yet
Enter text and click "Encode Text" to see results
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode data that needs to be stored or transmitted over media designed to deal with text.
Base64 encoding takes binary data and converts it into a radix-64 representation using 64 ASCII characters: A-Z, a-z, 0-9, +, and /.
Fast encoding and decoding with real-time processing.
Upload and encode files directly to Base64.
All processing happens locally in your browser.
One-click copying for seamless workflow integration.
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters. It's designed to allow binary data to be transmitted safely over text-based protocols and systems.
Base64 encoding increases data size by ~33%. For every 3 input bytes, you get 4 output characters. Formula: output_size = βinput_size Γ 4/3β
RFC 4648 standard using +, / for characters 62-63. Used in MIME, email attachments, and general data encoding.
Uses -, _ instead of +, / to avoid URL encoding issues. Safe for URLs, filenames, and HTTP headers.
Adds line breaks every 76 characters for email compatibility. Used in email attachments and MIME encoding.
Uses 32 characters (A-Z, 2-7), more human-readable, less efficient than Base64. Used in TOTP tokens.
Excludes similar-looking characters (0, O, I, l). Used in Bitcoin addresses and other cryptocurrencies.
Base16 encoding using 0-9, A-F. Less efficient but more readable for debugging and hash values.
Embed images directly in HTML/CSS without separate HTTP requests:
HTTP Basic Auth encodes credentials in Base64:
JWT headers and payloads are Base64-encoded JSON:
Email attachments are Base64-encoded to ensure safe transmission through text-based email systems that might corrupt binary data.
Non-ASCII characters in email subjects and content are often Base64-encoded to ensure compatibility across different email systems.
Binary data in messaging systems (images, files) is Base64-encoded for transmission over text-based protocols like XMPP or WebSocket.
Base64 is encoding, not encryption. It provides no security - anyone can decode it. Use proper encryption (AES, RSA) for sensitive data protection.
Always validate Base64 input before decoding. Check for valid characters, proper padding, and expected output size to prevent attacks.
For large files, consider streaming Base64 encoding/decoding to avoid memory issues. Use appropriate algorithms for your platform.
Use URL-safe Base64 for web tokens, standard Base64 for email, and consider Base32 for human-readable codes like 2FA tokens.
Base64 is easily decodable by anyone. Never use it alone for sensitive data. It only obfuscates data, providing no real security protection.
33% size increase can impact performance and storage. For large data, consider compression before encoding or alternative binary protocols.
Malicious Base64 content can contain harmful data. Always validate decoded content, especially when executing or including in web pages.
Base64 data in URLs, logs, or error messages can leak sensitive information. Be careful about where encoded data appears in your application.
// Text to Base64 const encoded = btoa("Hello World!"); console.log(encoded); // SGVsbG8gV29ybGQh // File to Base64 const reader = new FileReader(); reader.onload = e => { const base64 = e.target.result.split(',')[1]; }; reader.readAsDataURL(file);
// Base64 to text const decoded = atob("SGVsbG8gV29ybGQh"); console.log(decoded); // Hello World!
import base64 # Text to Base64 text = "Hello World!" encoded = base64.b64encode(text.encode()).decode() print(encoded) # SGVsbG8gV29ybGQh # File to Base64 with open("file.jpg", "rb") as f: encoded = base64.b64encode(f.read()).decode()
# Base64 to text decoded = base64.b64decode(encoded).decode() print(decoded) # Hello World!
import java.util.Base64; // Encoding String text = "Hello World!"; String encoded = Base64.getEncoder() .encodeToString(text.getBytes()); // Decoding byte[] decoded = Base64.getDecoder() .decode(encoded); String result = new String(decoded);
require 'base64' # Encoding text = "Hello World!" encoded = Base64.encode64(text) # Decoding decoded = Base64.decode64(encoded) puts decoded # Hello World!
A: Base64 is encoding, not encryption. It converts data format but provides no security. Anyone can easily decode Base64 data. For security, use proper encryption algorithms like AES before Base64 encoding if needed.
A: Base64 represents 3 bytes of binary data with 4 text characters, creating a ~33% size increase. This overhead is the trade-off for making binary data text-safe. Use compression before encoding for large files.
A: Padding characters ('=') ensure the output length is a multiple of 4. They're added when the input length isn't divisible by 3. One '=' means 2 bytes input, two '==' means 1 byte input in the final group.
A: Yes, especially with URL-safe Base64. Since the output length determines padding needed, decoders can often work without explicit padding. However, some systems require it, so check your specific use case.
A: Use URL-safe Base64 when the encoded data will appear in URLs, filenames, or HTTP headers. It replaces '+' with '-' and '/' with '_' to avoid URL encoding issues. Essential for web tokens and REST APIs.
A: For large files, use streaming/chunked processing instead of loading everything into memory. Process data in fixed-size chunks (multiples of 3 bytes for encoding) to maintain constant memory usage.
A: Base64 uses 64 characters and is ~33% larger than input. Hexadecimal uses 16 characters (0-9, A-F) and is 100% larger. Base64 is more efficient for storage but hex is more human-readable for debugging.
A: Yes: Base32 (more human-readable), Base58 (no ambiguous characters), Base85 (more efficient), or modern binary protocols like Protocol Buffers or MessagePack for structured data. Choice depends on your specific requirements.