Skip to content

Free tool

Base64 Encoder and Decoder

Encode text to Base64 or decode Base64 back to text. Full UTF-8 support for non-ASCII characters. Free, no signup required.

Text input0 chars, 0 bytes

What Is Base64 Encoding?

Base64 is a group of binary-to-text encoding schemes that represent binary data as a sequence of printable ASCII characters. The name comes from the 64 characters used in the encoding alphabet: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two additional characters (+ and /). An = sign is used for padding when the input length is not divisible by three.

Base64 was originally designed for sending binary data through systems that only handle text, such as email (MIME) and early internet protocols. Today, it is widely used in web development, APIs, and data storage wherever binary data needs to be represented as text.

When to Use Base64

Base64 encoding is useful in several common scenarios in web development and software engineering.

  • Data URLs: Embed small images, fonts, or files directly in HTML or CSS without additional HTTP requests. The format is data:mime/type;base64,DATA.
  • Email attachments: MIME encoding uses Base64 to include binary files in email messages, which are fundamentally text-based.
  • API authentication: HTTP Basic Authentication sends credentials as a Base64-encoded string in the Authorization header.
  • JSON and XML payloads: Binary data like images or certificates can be included in JSON or XML by encoding them as Base64 strings.
  • URL-safe tokens: Modified Base64 (using - and _ instead of + and /) is used in JWTs, signed URLs, and other token formats.

Base64 in Web Development

Every modern browser has built-in Base64 support through the btoa() and atob() functions. However, these functions only handle Latin-1 characters. For Unicode and UTF-8 text, you need to use the TextEncoder and TextDecoder APIs first, which is exactly what this tool does.

Keep in mind that Base64 increases data size by about 33%. For large files, it is more efficient to transfer them as binary (using multipart form data or binary streams) rather than encoding them as Base64. Reserve Base64 for small assets, inline data, and cases where a text-only transport is required.

Frequently asked questions

Base64 is a binary-to-text encoding scheme that converts binary data into a string of ASCII characters. It uses 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding. Base64 is commonly used to embed binary data in text-based formats like JSON, XML, HTML, and email.

More free tools