Base64 Encoder & Decoder - Online Base64 Tool
Free online Base64 encoder and decoder. Encode and decode text, files, and data to/from Base64 format. Secure and fast conversion with real-time preview.
File Upload
Drop a file here or
Any file type supported
Input (Text)
Output (Base64)
About Base64 Encoding
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in sequences of 24 bits, translating them into four Base64 digits. It's commonly used for encoding data in email and web applications.
Common Use Cases
- Embedding images in HTML/CSS
- API authentication tokens
- Data transmission over text-based protocols
- Storing binary data in JSON/XML
Understanding Base64 Encoding & Decoding
Base64 encoding converts binary data into ASCII text by mapping groups of 6 bits to 64 printable characters (A-Z, a-z, 0-9, +, /). This encoding is essential for transmitting binary data over text-based protocols like HTTP, SMTP, and JSON, which historically could not safely handle raw binary bytes. When you encode a file to Base64, its size increases by approximately 33% because each 3 bytes (24 bits) becomes 4 Base64 characters. While this size overhead seems wasteful, it is the price of compatibility—without Base64 encoding, binary data would be corrupted when transmitted through systems that expect text. This tool handles the conversion automatically, including edge cases like padding with = characters and UTF-8 text handling.
Base64 is not encryption or compression—it is a reversible transformation that makes binary data readable as text. Importantly, Base64-encoded data is not secure; anyone with a Base64 string can instantly decode it. For security-sensitive data, you must encrypt it before Base64 encoding. The tool supports standard Base64 and URL-safe Base64 (where + becomes - and / becomes _), which is commonly used in URLs and JWT tokens. Understanding when and how to use Base64 is crucial for API development, file uploads, and data interoperability.
Common Use Cases
- HTTP Basic Authentication: Encode username:password as Base64 for the Authorization: Basic header in REST APIs.
- JSON File Encoding: Encode binary files (PDFs, images, ZIP archives) as Base64 strings for inclusion in JSON API payloads.
- Email Attachments: Encode email attachments as Base64 for MIME format compliance when sending emails programmatically.
- Data URIs in HTML/CSS: Encode small images as Base64 data URIs to embed directly in HTML or CSS, reducing HTTP requests.
- Configuration & Secrets: Encode sensitive configuration values for storage in environment files or configuration management systems.
- JWT Tokens: JWT headers and payloads use URL-safe Base64 encoding to create compact token strings for stateless authentication.
How to Use This Tool
- Select Mode: Choose Encode (text → Base64) or Decode (Base64 → text) using the toggle at the top.
- Input Your Data: Paste text directly in the textarea, or use file upload/drag-drop to select files for encoding.
- Configure Options: For encoding, toggle "Format output" to add line breaks for readability (useful for viewing large encoded data).
- View Results: See instant output in the right panel with character and byte statistics.
- Copy or Download: Use the copy button for quick clipboard access, or download the output as a file.
Features
Standard vs URL-Safe
Standard Base64 uses + and / characters. URL-safe Base64 replaces + with - and / with _ for safe inclusion in URLs and JWT tokens.
File Upload Support
Drag and drop or select any file (images, PDFs, documents, executables) for Base64 encoding. Binary files handled correctly with MIME type detection.
UTF-8 Text Handling
Supports multi-byte Unicode characters. Encodes UTF-8 bytes as Base64, preserving special characters, emojis, and non-ASCII text.
Padding & Validation
Handles Base64 padding (= characters) correctly and validates decoded data. Shows clear error messages for invalid Base64 input.
Frequently Asked Questions
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is used to safely transmit binary data over text-based protocols like HTTP, SMTP, and JSON, where raw binary bytes could be corrupted.
Is Base64 encryption?
No, Base64 is not encryption. It is a reversible encoding that makes binary data text-safe. Anyone can instantly decode Base64 strings, so it provides no security. For sensitive data, encrypt first, then Base64-encode the encrypted output.
What is the size overhead of Base64?
Base64-encoded data is approximately 33% larger than the original binary. Every 3 bytes (24 bits) becomes 4 Base64 characters. For example, a 100 KB file becomes ~133 KB when Base64-encoded, making it important to consider when designing APIs.
What is URL-safe Base64?
URL-safe Base64 replaces + with - and / with _ to ensure the encoded string is safe for URLs and JWT tokens. Standard Base64 characters + and / have special meaning in URLs and could be misinterpreted.