Skip to content
DEVELOPER UTILITY

Base64 Encoder & Decoder

Encode and decode Base64 strings instantly — free, private, and entirely in your browser

Base64 Encoder

Quick samples:

Related Tools

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. It was originally designed to safely transmit binary data through systems that only support text, such as email (SMTP/MIME) and early HTTP. The encoding converts every 3 bytes of binary input into 4 ASCII characters, using the alphabet A-Z, a-z, 0-9, +, and /, with = as a padding character.

Base64 is defined in RFC 4648 and is one of the most widely used encoding schemes in computing. Despite its ubiquity, it is important to understand that Base64 is not encryption — it provides no security whatsoever and can be instantly reversed by anyone.

How Does Base64 Encoding Work?

The encoding process works in three steps. First, the input data is converted to its binary representation (a sequence of bytes). Then, these bytes are grouped into chunks of 3 bytes (24 bits). Each 24-bit chunk is split into four 6-bit groups, and each 6-bit value (0–63) is mapped to a character in the Base64 alphabet.

If the input length is not a multiple of 3 bytes, padding is applied: one remaining byte produces two Base64 characters plus ==, while two remaining bytes produce three characters plus =. This ensures the encoded output length is always a multiple of 4.

The decoding process is the exact reverse: each Base64 character is converted back to its 6-bit value, groups of four 6-bit values are combined into three bytes, and padding characters are removed from the end.

Why Use Base64 Encoding?

  • Email attachments: SMTP only supports 7-bit ASCII. Base64 encodes binary attachments (images, PDFs) so they can travel through email safely.
  • Data URIs: Embed small images, fonts, or files directly in HTML, CSS, or JavaScript without additional HTTP requests.
  • API payloads: Transmit binary data (file uploads, cryptographic material) within JSON or XML structures that only support text.
  • Authentication: HTTP Basic Auth encodes username:password as Base64 in the Authorization header.
  • Certificates and keys: PEM format wraps DER-encoded certificates and private keys in Base64 with header/footer lines.
  • Configuration storage: Kubernetes Secrets, CI/CD variables, and config files use Base64 to store binary values in text-based formats like YAML or JSON.

Who Uses Base64 Encoding?

Web developers use Base64 daily for data URIs, API integrations, and JWT tokens. Backend engineers encounter it when serializing binary data in JSON APIs and processing file uploads. DevOps and SRE teams work with it in Kubernetes Secrets, Docker configs, and SSL/TLS certificate management.

Security professionals see Base64 in authentication headers, token payloads, and encoded payloads during penetration testing. Data engineers use it when storing or transmitting binary blobs in text-oriented databases and message queues.

How to Use This Tool

  1. Select Encode to convert text to Base64, or Decode to convert Base64 back to text.
  2. Paste or type your input in the left pane. Use the quick sample buttons for common examples.
  3. Toggle URL-safe mode if you need Base64URL encoding (replaces + with -, / with _, and strips padding).
  4. Click the action button to convert. The result appears in the right pane.
  5. Use the Copy button to copy the result, or Switch to swap input and output for round-trip testing.

Frequently Asked Questions About Base64 Encoding