Base64

Input

Why Encode Base64 Client-Side?

Base64 encoding is frequently used with sensitive data—authentication tokens, API keys, encrypted content, and binary files. Many online Base64 tools send your data to their servers, creating a security risk.

Utiliti's Base64 encoder runs entirely in your browser. Your data never leaves your device, making it safe to encode or decode:

  • JWT Tokens: Decode and inspect authentication tokens without exposure
  • API Credentials: Safely encode Basic Auth headers
  • Encrypted Data: Work with encrypted payloads privately
  • Binary Files: Convert images and files to Base64 for embedding

Features

  • Encode: Convert plain text or binary data to Base64 format
  • Decode: Convert Base64 strings back to their original form
  • URL-Safe Mode: Generate URL-safe Base64 that replaces + and / with - and _ for use in URLs and filenames
  • Instant Processing: No server round-trip means immediate results

What is Base64?

Base64 is a binary-to-text encoding scheme that is commonly used to encode binary data, such as images, audio files, or other binary content, into a text-based format. The encoding is called Base64 because it uses a set of 64 characters, consisting of A-Z, a-z, 0-9, and two additional characters, usually '+', and '/'. The '=' character is often used as padding at the end of the encoded data to ensure that the length of the encoded text is a multiple of 4.

The primary purpose of Base64 encoding is to represent binary data in a format that is safe for transport and storage in text-based systems, such as email or XML documents. It is commonly used in various applications, including:

  1. Email Attachments: Binary files (e.g., images or documents) are often Base64-encoded when included as attachments in email messages.
  2. Data URLs: In web development, Base64 encoding is sometimes used to embed small images or other resources directly into HTML or CSS files using data URLs.
  3. APIs and Web Services: Base64 encoding is used to encode binary data in JSON or XML payloads when exchanging information between systems.
  4. Data Storage: Base64 encoding can be used to store binary data in a text-based format, making it easier to work with in certain environments.

The process of Base64 encoding involves breaking the binary data into chunks of 6 bits, which are then represented by a corresponding character in the Base64 character set. These chunks are combined to form the Base64-encoded string. Decoding is the reverse process, where Base64-encoded data is converted back to its original binary form.

Here is a simple example:

Original binary data: 01001001 00110010 00111000 (24 bits)

Base64-encoded: SSY= (encoded using ASCII characters)

It's important to note that while Base64 encoding is useful for representing binary data in a text-based format, it does not provide encryption or security. The purpose is primarily to ensure compatibility with text-based systems that may not handle binary data well.

Common Use Cases

  • Embedding Images: Convert images to Base64 data URLs for inline embedding in HTML or CSS
  • API Authentication: Encode credentials for HTTP Basic Authentication headers
  • Data Transfer: Safely transmit binary data through text-only channels like JSON or XML
  • Debugging JWTs: Decode the payload section of JSON Web Tokens to inspect claims
  • Email Attachments: Understand how email systems encode binary attachments

Base64 vs URL-Safe Base64

Standard Base64 uses the characters + and / which have special meanings in URLs. URL-safe Base64 (also called Base64URL) replaces these with - and _ respectively, making the encoded string safe for use in URLs, filenames, and other contexts where + and / might cause issues. Enable the "URL Safe" option when encoding data that will be used in URLs or file paths.

Popular Utilities