Base64 Encoder
Encode and decode text or files using Base64 encoding.
Suggest a new tool
Tell us what you'd like to see next
How to Use Base64 Encoder
- 1For text encoding: type or paste your text in the input area and click 'Encode β Base64'.
- 2For decoding: paste a Base64 string and click 'Decode β Base64'.
- 3For file encoding: switch to 'File β Base64' mode and select any file.
- 4The full data URI is shown β click 'Copy' to copy just the Base64 part (after the comma).
- 5Use the output anywhere that accepts Base64 β HTML img src attributes, CSS backgrounds, API payloads, etc.
Frequently Asked Questions
What is Base64 encoding?
Base64 is an encoding scheme that converts binary data (or any text) into a string of ASCII characters using 64 printable characters. It's commonly used to transmit binary data over text-based protocols like email (MIME), JSON APIs, and HTML attributes.
Why would I need to Base64 encode a file?
Embedding files as Base64 strings in HTML, CSS, or JSON allows you to include images, fonts, or other assets inline without separate HTTP requests. It's also used to send binary file content through APIs that only accept text/JSON.
Does Base64 encrypt my data?
No. Base64 is encoding, not encryption. Anyone with a Base64 decoder can read the original content. Never use Base64 for security β use proper encryption for sensitive data.
Why is my Base64 string longer than the original?
Base64 encoding increases size by approximately 33%. Every 3 bytes of input become 4 Base64 characters. This is the inherent trade-off of representing binary data in a text-safe format.
About Base64 Encoder
The Base64 Encoder and Decoder is a versatile tool for developers and technical users who need to convert between raw text or binary files and their Base64 representations. Base64 encoding is ubiquitous in web development β from embedding images inline in HTML and CSS, to encoding credentials in HTTP Basic Auth headers, to sending file attachments through JSON APIs.
The Text Mode handles any Unicode text, correctly encoding multi-byte characters (including emoji, Arabic, Chinese, and other non-ASCII text) by first converting to UTF-8 bytes before encoding. This ensures the output is valid and decodable across all platforms and programming languages.
The File Mode reads any file you select and generates its data URI representation β the format used to embed files directly in web pages. The complete data URI includes the MIME type prefix (e.g. data:image/png;base64,) followed by the encoded content. The copy button extracts just the Base64 portion for use in API calls and other contexts that expect raw Base64.
All encoding and decoding happens entirely in your browser using the built-in btoa() and atob() functions combined with TextEncoder/TextDecoder for proper Unicode handling. Your files and text never leave your device, making this tool safe for encoding sensitive configuration files, private keys, and confidential documents.