Free Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to plain text. Everything runs in your browser — nothing is uploaded.

Encode to Base64

Decode from Base64

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used when binary data needs to be transmitted over text-based protocols.

Common Use Cases

  • Data URIs — embed images directly in HTML/CSS using data:image/png;base64,...
  • Email attachments — MIME encoding uses Base64 for binary attachments
  • API authentication — HTTP Basic Auth encodes credentials in Base64
  • QR code data — binary data in QR codes is often Base64-encoded
  • JSON Web Tokens (JWT) — the payload of JWTs is Base64url-encoded

How It Works

Base64 takes 3 bytes (24 bits) of binary data and splits them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input length isn't a multiple of 3, padding characters (=) are added.

Frequently Asked Questions

What is Base64 actually for?

It re-expresses binary data using 64 printable characters, so that data can travel through systems that only handle text — email bodies, JSON fields, HTML attributes, URLs. It exists to survive transport, not to compress or protect anything.

Is Base64 a form of encryption?

No, and treating it as one is a common and costly mistake. Base64 is a reversible encoding with no key: anyone can decode it instantly. It offers no confidentiality whatsoever, so never use it to hide a password, token or key.

Why does Base64 output end in equals signs?

Base64 works in three-byte groups that become four characters. When the input length is not a multiple of three, the final group is padded, and one or two '=' characters mark how much padding was added so a decoder can reconstruct the exact original length.

Why is my Base64 string bigger than the original?

Encoding three bytes as four characters adds roughly 33% overhead, before any line breaks. That is the price of making binary data text-safe, and it is why embedding large images as Base64 data URIs can noticeably increase page weight.

What is URL-safe Base64?

A variant that replaces the '+' and '/' characters with '-' and '_', because the standard characters have reserved meanings in URLs and would otherwise need escaping. Padding is often dropped too. JSON Web Tokens use this variant.

Why does my decode fail or produce mojibake?

Usually one of three things: the string was truncated, it lost its padding, or it was URL-safe Base64 fed to a standard decoder. Non-ASCII text is another cause — accented characters and emoji must be encoded as UTF-8 bytes before Base64, and decoded back the same way.

Can I Base64-encode an image?

Yes, and it is how data URIs work — the image travels inline instead of as a separate request. It suits small icons; for larger images the 33% size penalty and the loss of separate caching usually outweigh saving one request.

Is my data sent to a server?

No. Encoding and decoding happen entirely in your browser. Nothing is uploaded or logged, which matters because Base64 strings routinely contain configuration, tokens or personal data.

Scan QR Codes Containing Base64 Data

The Scan & Generate app can scan QR codes and barcodes that contain encoded data, with one-tap copy and share functionality.