Base64 Encoder & Decoder
Encode or decode Base64 text and files. Switch on URL-safe output for tokens or URLs, wrap long output when needed, and copy or download the result.
Input
Output
Drop file here or click to browse
Any file type supportedHow to Encode or Decode Base64
- Choose your mode — Use Text Mode for encoding/decoding text strings, or File Mode to encode any file to Base64.
- Enter your data — Paste text or Base64 string in Text Mode, or drop a file in File Mode.
- Click Encode or Decode — Copy the result or download it as a text file.
How It Works: Base64 Encoding & RFC 4648 Binary Translation
What is Base64 Encoding?
Base64 encoding is a binary-to-text translation scheme defined by the RFC 4648 standard that represents arbitrary sequences of 8-bit octets using a restricted set of 64 printable ASCII characters. It enables raw binary files, images, and cryptographic keys to be transmitted safely over text-based channels such as email, JSON APIs, and URLs without data corruption.
How It Works in the Browser
Our converter performs high-speed bitwise transformations in the browser using native JavaScript ArrayBuffers and TextEncoder APIs:
- Byte-to-ASCII 6-Bit Translation: Input text or binary data is converted into an 8-bit byte array. Through byte-to-ASCII 6-bit translation, every three 8-bit bytes (24 bits total) are split into four 6-bit chunks (values from 0 to 63).
- Alphabet Mapping: Each 6-bit integer indexes into the standard Base64 alphabet: uppercase letters
A-Z(0–25), lowercasea-z(26–51), digits0-9(52–61), plus+(62) and/(63). - Padding Rules: In accordance with standard padding rules, if the input byte length is not divisible by 3, one or two
=characters are appended as padding to complete the final 4-character block. - URL-Safe Variation Handling: In URL-safe mode,
+is replaced with-and/with_to prevent conflict with URL reserved characters.
Key Specifications & Performance Characteristics
The algorithm strictly adheres to the RFC 4648 standard for Base64 and Base64URL. Applying byte-to-ASCII 6-bit translation and rigorous padding rules, Base64 maps 3 bytes of binary data into 4 ASCII characters, introducing a deterministic 33.3% size overhead. Decoding operations validate character boundaries, reject illegal characters, and reconstruct raw binary octets with zero server involvement.
Features
- Encode text to Base64 (Unicode-safe)
- Decode Base64 back to text
- Encode any file to Base64
- URL-safe output and line wrapping
- Shows data URL for images
- Image preview for encoded images
Base64 encoder and decoder for text and files
Use Base64 Encoder to encode UTF-8 text, decode Base64 back to text, or convert a file into Base64 output. Base64 changes how data is represented; it does not encrypt or protect the content.
Example workflow
- Token-friendly text: Encode a short value, turn on URL-safe output, then copy it into a URL or token field.
- Inline image: Use File Mode with an image to get both raw Base64 and a complete data URL preview.
- Limits: Malformed Base64 shows a decode error, and very large files depend on browser memory.
For the next step, try JSON Formatter & Validator, Regex Tester & Log Extractor, Hash Generator, Unix Timestamp Converter.