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 supported

How to Encode or Decode Base64

  1. Choose your mode — Use Text Mode for encoding/decoding text strings, or File Mode to encode any file to Base64.
  2. Enter your data — Paste text or Base64 string in Text Mode, or drop a file in File Mode.
  3. 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:

  1. 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).
  2. Alphabet Mapping: Each 6-bit integer indexes into the standard Base64 alphabet: uppercase letters A-Z (0–25), lowercase a-z (26–51), digits 0-9 (52–61), plus + (62) and / (63).
  3. 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.
  4. 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

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

For the next step, try JSON Formatter & Validator, Regex Tester & Log Extractor, Hash Generator, Unix Timestamp Converter.

Frequently Asked Questions

What is Base64 encoding? +
Base64 is an encoding scheme that represents binary data as text. It is useful for data URLs, APIs, and transport formats, but it is not encryption.
Does Base64 encrypt my data? +
No. Base64 is reversible encoding. Anyone with the encoded text can decode it, so do not use Base64 to protect secrets.
What is URL-safe Base64? +
URL-safe Base64 swaps characters that can be awkward in URLs and tokens. Use it when the encoded value needs to travel inside a URL or token-like string.
What is a data URL? +
A data URL combines a MIME type and Base64 content in a single string, such as data:image/png;base64,... for embedding small files inline.
Can large files be encoded? +
File encoding depends on available browser memory. Very large files can be slow or fail to process.