Base64 Encoder & Decoder
Convert text or image files to Base64 strings, or decode Base64 back to original files.
The Base64 Encoder & Decoder is a developer utility designed to translate plain text or binary files into ASCII text using the 64-character encoding schema, or decode Base64 strings back to their original forms. Running on native Web APIs like `FileReader` and local JS converters, it provides a secure, offline-capable utility. Developers frequently encode small graphical assets into Base64 Data URIs to reduce HTTP requests, or encode tokens for safe transmission. Using online tools for these conversions can leak API keys, user tokens, or proprietary graphics. This tool runs 100% client-side, ensuring that your inputs are never sent over the network, providing complete data isolation. [Mathematical Encoding Principles] Computer data is represented in 8-bit bytes. The Base64 algorithm maps these 8-bit sequences into 6-bit groups (2^6 = 64). A block of 3 bytes (24 bits) is encoded into exactly 4 6-bit characters. Each 6-bit value is mapped to a character index defined by RFC 4648 (A-Z, a-z, 0-9, +, /). If the input data length is not a multiple of 3, '=' padding characters are appended. The decoder reverses this mapping, translating 6-bit ASCII values back into the original 8-bit binary stream. [Step-by-Step Guide] 1. To Encode: Paste your text into the input box, or drag and drop any image/file into the upload area. 2. The Base64 string will update instantly. Select 'Pure Base64' or 'Data URI' (for HTML/CSS tags) and click copy. 3. To Decode: Paste your Base64 string into the decoder panel. 4. The decoder will automatically display the decoded text or render the decoded image file directly in the browser. 5. Copy the result or download it as a raw file. [Frequently Asked Questions & Precautions] - Q: Why is my Base64 string larger than the original file size? - A: Base64 encoding represents 3 bytes of binary data using 4 ASCII characters, resulting in a mathematical file size increase of approximately 33%. For web optimization, only encode small assets (under 20KB) to prevent bloated code.