Skip to content
BCBinary Code Translator
Menu

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 to text. Auto-detects input format for seamless conversion.

Input
0 chars·0 words·0 lines
Output
0 chars
Try an example

How Base64 Encoding Works

Base64 encoding works by dividing input data into 3-byte (24-bit) chunks and converting each chunk into four 6-bit Base64 characters.

The Base64 Alphabet:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

Padding: If the input length is not divisible by 3, padding characters (=) are added at the end.

Example: “M” (77 in ASCII) = 01001101 in binary = TQ==

Common Base64 Encoding Examples

Here are some common Base64 encoding examples:

Original Text Base64 Encoded Notes
Hello SGVsbG8= Simple text with padding
World V29ybGQ= Five-character word
Hello World! SGVsbG8gV29ybGQh Includes a space and punctuation
Base64 QmFzZTY0 No padding needed
user:password dXNlcjpwYXNzd29yZA== Basic Auth style value
{"ok":true} eyJvayI6dHJ1ZX0= Small JSON payload

Common Use Cases for Base64

  • Email Attachments: Base64 is used in MIME email format to encode binary attachments
  • Data URLs: Embed small images in HTML/CSS using data:image/png;base64,…
  • API Authentication: Many APIs use Base64 for Basic Auth (username:password)
  • Configuration Files: Store binary data or special characters in JSON/XML configs
  • Web Development: Encode data payloads in AJAX requests

Base64 decoding errors and safe usage tips

Base64 is an encoding format, not encryption. Anyone with the encoded value can decode it, so do not use Base64 alone to protect passwords, private keys, tokens, or confidential data.

If a Base64 value does not decode, check for missing characters, copied line breaks, URL-safe variants that use - and _, or missing = padding at the end.

  • Use Base64 when binary data must travel through a text-only system.
  • Avoid Base64 for large images in production pages because it increases size and can reduce caching efficiency.
  • Use URL encoding instead when the goal is only to make query parameters safe inside a URL.

Frequently asked questions

What is Base64?

Base64 is an encoding scheme that converts binary data into text format using 64 characters (A-Z, a-z, 0-9, +, /). It is designed to represent binary data in ASCII string format.

Why use Base64 encoding?

Base64 is commonly used to encode binary data in emails, URLs, and XML. It ensures data remains intact during transport through systems that may interpret certain characters as special commands.

What does Base64 encoding look like?

Base64 encoded strings end with one or two = padding characters. For example, "Hello" becomes "SGVsbG8=" in Base64.

Is Base64 encryption?

No, Base64 is encoding, not encryption. It is not designed for security - it is easily decoded back to the original data.

Related tools

View all tools

Cookie Preferences

Manage your cookie preferences. Necessary cookies cannot be disabled.

Necessary

Required

Required for language selection, privacy choices, and basic site functionality.

Cookies: NEXT_LOCALE

Analytics

Optional analytics cookies help us understand traffic and improve the website.

Cookies: _ga, _gid, _gat, _clck, _clsk

Advertising

Optional advertising cookies may be used to show relevant ads and measure performance.

Cookies: __gads, _gcl_au, IDE