Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 strings instantly. Drag and drop files to encode them too.
📁 Drag & drop a file here to encode it
or click to select a file
How to Use the Base64 Encoder / Decoder
This tool converts between plain text and Base64 encoding in both directions. It is essential for developers working with APIs, data URIs, email systems, or any protocol that requires binary data to be represented as text.
- Choose a mode: Click Encode to convert plain text or files into Base64, or Decode to convert a Base64 string back to readable text.
- Enter your data: Type or paste text into the input field. When encoding, you can also drag and drop a file onto the drop zone to encode its contents as Base64.
- Click Convert: The result appears in the output field. Use the Copy button to transfer it to your clipboard.
What Is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 ASCII characters: A–Z, a–z, 0–9, +, and /, with = used for padding. It was originally designed for safe transmission of binary content through text-based systems like email (MIME) and later became widely used in web development for embedding images in CSS, passing tokens in HTTP headers, and encoding data in JSON Web Tokens (JWTs).
Common Use Cases
- Data URIs: Embed small images directly in HTML or CSS using
data:image/png;base64,...to reduce HTTP requests. - API Authentication: HTTP Basic Authentication sends credentials as a Base64-encoded
username:passwordstring in the Authorization header. - Email Attachments: MIME encoding uses Base64 to attach binary files to email messages that travel through text-only SMTP servers.
- JWT Tokens: JSON Web Tokens encode their header and payload sections using Base64URL encoding (a URL-safe variant).
- Configuration Storage: Binary certificates and keys are often stored as Base64 in environment variables or YAML configuration files.
UTF-8 Handling
Standard JavaScript btoa() only works with Latin-1 characters. This tool handles full UTF-8 text (including emojis and international characters) by first encoding the string to UTF-8 bytes before applying Base64 encoding, and reversing the process when decoding. This ensures that characters like こんにちは or 🎉 are encoded and decoded correctly.
Frequently Asked Questions
What is Base64 encoding used for?
Base64 encoding converts binary data into ASCII text using 64 printable characters. It is commonly used to embed images in HTML or CSS, send binary attachments in email (MIME), transmit data in JSON or XML payloads, and store binary content in text-only systems like environment variables or configuration files.
Does Base64 encoding encrypt my data?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string back to its original content. If you need to protect sensitive data, use proper encryption (such as AES or RSA) before encoding to Base64. Base64 is designed for safe transport of data, not for security.
Why does Base64 output become larger than the input?
Base64 represents every 3 bytes of input as 4 ASCII characters, resulting in roughly a 33% size increase. This overhead is the trade-off for ensuring the data contains only safe, printable characters that can pass through text-based protocols without corruption.