Base64 Encoder/Decoder

4.7 (36)

Encode text to Base64 or decode Base64 back to readable text. Fast, free, and works entirely in your browser.

0 characters

How to Use

1

Enter your text or Base64 string

2

Click Encode or Decode

3

Copy the result

4

Use for APIs, data URIs, and more

About Base64 Encoder/Decoder

What This Tool Does

This Base64 encoder and decoder converts text to and from Base64 encoding instantly. All processing happens entirely in your browser using JavaScript's built-in btoa() and atob() functions - no data is ever sent to any server, making it completely private and secure for sensitive information.

Understanding Base64

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. The name "Base64" comes from the fact that it uses 64 different characters to represent data: A-Z (26), a-z (26), 0-9 (10), plus two additional characters (+ and /).

The equals sign (=) is used for padding when the input length isn't divisible by 3, as Base64 encodes 3 bytes of data into 4 ASCII characters.

Why Base64 Exists

Many systems were designed to handle text, not binary data. Email systems, for example, originally only supported 7-bit ASCII text. Base64 was created to safely transport binary data (like images or files) through these text-only channels without corruption.

How Encoding Works

Base64 takes 3 bytes (24 bits) of binary data and converts it into 4 characters. Each character represents 6 bits of the original data. This means Base64-encoded data is about 33% larger than the original binary data.

Example: "Hi" → "SGk="

  • H (72) + i (105) = binary 01001000 01101001
  • Split into 6-bit groups: 010010 000110 1001(00)
  • Map to Base64 alphabet: S, G, k, = (padding)

Common Uses for Base64

Data URIs

Embed images directly in HTML or CSS without separate file requests:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSU...">

This is useful for small images, icons, or when you want to reduce HTTP requests.

API Communications

JSON doesn't natively support binary data. Base64 encoding allows binary content (files, images) to be included in JSON payloads for REST APIs.

HTTP Basic Authentication

The Authorization header uses Base64 to encode username:password:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Email Attachments (MIME)

Email protocols encode attachments in Base64 to ensure they survive transport through text-only email systems.

Storing Binary in Databases

Some databases or configuration files only accept text. Base64 lets you store binary data in these text-only environments.

Important Security Notes

Base64 is NOT Encryption

This is a critical distinction. Base64 is encoding, not encryption:

  • Encoding: Transforms data format; easily reversible by anyone
  • Encryption: Secures data; requires a key to reverse

Never use Base64 to "hide" passwords, API keys, or sensitive data. Anyone can decode Base64 instantly.

Privacy First

This tool processes everything locally in your browser. Your data is never sent to our servers or any third party. You can verify this by monitoring network requests in your browser's developer tools.

UTF-8 and Special Characters

Our encoder properly handles UTF-8 and special characters (émojis, accented letters, non-Latin scripts) by first encoding the text to UTF-8 before Base64 encoding. Standard Base64 only supports ASCII, but our implementation handles the full Unicode range.

Base64 Variants

This tool uses standard Base64 (RFC 4648). Other variants exist:

  • Standard: Uses + and / (this tool)
  • URL-safe: Uses - and _ instead of + and /
  • MIME: Allows line breaks (used in email)

FAQ

What is Base64?
Base64 is an encoding scheme that converts binary data to ASCII text using 64 characters (A-Z, a-z, 0-9, +, /). It's commonly used in emails, data URIs, and APIs.
Is my data safe?
Yes! All encoding and decoding happens in your browser. No data is sent to our servers.
Can I encode images?
This tool encodes text. For images, you would need a file-to-Base64 converter.