Base64 string encoder

Encode and decode strings to/from Base64 format

Input

Enter text to encode to Base64

Switch to Decode

Output

Base64 encoded result

Base64 explained

TL;DR

What is Base64 string encoder?

Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It is not encryption: anyone can decode a Base64 string instantly without a key. The encoded output is approximately 33% larger than the original input.

How it works

Base64 groups every 3 bytes of input (24 bits) into four 6-bit chunks, then maps each chunk to one of the 64 characters in its alphabet. If the input length is not divisible by 3, one or two = padding characters are appended so the output length is always a multiple of 4.

Common use cases

  • Data URIs: embed images, fonts, or other binary files directly in HTML, CSS, or JSON without a separate file request
  • HTTP Basic Authentication: credentials are Base64-encoded in the Authorization header (note: this is encoding, not security)
  • Email attachments: MIME encoding uses Base64 to transmit binary attachments through text-only email protocols
  • API payloads: pass binary data through JSON APIs that only support string values

Frequently asked questions

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. It has no key and provides no confidentiality. Anyone can decode it in one step. Never use Base64 to hide sensitive data.

What is URL-safe Base64?

Standard Base64 uses + and / which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _, making the output safe to include in query parameters and path segments without percent-encoding. JWT tokens use URL-safe Base64.

Why does Base64 output end with == ?

The = characters are padding. Base64 encodes 3 bytes at a time. If the input length is not a multiple of 3, one or two = characters are appended to bring the output to a multiple of 4 characters.

See also

  • JWT decoder: JWT header and payload segments are Base64URL-encoded JSON. Paste a JWT segment here to decode it independently
  • URL encoder: standard Base64 uses + and / which are special in URLs; URL-encode a Base64 string when embedding it as a query parameter
  • Image to Base64: encode image files specifically to Base64 data URIs for inline embedding in HTML or CSS