Base64 Encoder & Decoder Online

Encode text or files to Base64, decode Base64 strings — instant, browser-based, no data sent to any server.

Enter any text to encode it to Base64.

Output length: 0 characters

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using only 64 printable ASCII characters — the uppercase letters A–Z, lowercase a–z, digits 0–9, plus + and / (with = as a padding character). Every 3 bytes of input become 4 Base64 characters, expanding the data by roughly 33%.

The name comes from the 64-character alphabet used. It was standardized in RFC 4648 and is one of the most widely used encodings in web development and data transfer.

Common Use Cases

  • Email attachments (MIME): SMTP was designed for ASCII text. Base64 allows binary files (images, PDFs, etc.) to be embedded inside email bodies via MIME encoding.
  • Data URLs: Inline images and fonts in HTML/CSS using data:image/png;base64,... to avoid extra HTTP requests.
  • JWT (JSON Web Tokens): The header and payload of a JWT are Base64URL-encoded (a URL-safe variant using - and _ instead of + and /).
  • HTTP Basic Authentication: Credentials are sent as Authorization: Basic <base64(user:pass)> in request headers.
  • API keys & secrets: Many APIs encode binary keys or cryptographic material as Base64 for safe transport over JSON or HTTP.
  • SSL certificates: PEM files (the ones with -----BEGIN CERTIFICATE-----) contain DER-format certificates encoded as Base64.

How This Tool Works

This encoder/decoder runs entirely in your browser using the native btoa() and atob() JavaScript APIs, extended with TextEncoder for full Unicode support. No data is sent to any server — processing is instant and completely private.

  • Encode: Converts UTF-8 text to Base64 string.
  • Decode: Converts a Base64 string back to UTF-8 text.
  • File Encode: Reads any file as binary and produces its Base64 representation (useful for embedding images as data URLs).
  • Auto-detect: Tries to detect whether the input looks like Base64 and picks the correct operation automatically.

Frequently Asked Questions

Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone who has the Base64 string can trivially decode it back to the original data — no key or password is required. Do not use Base64 to protect sensitive information.

Why does Base64 output end with == or =?

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

What is Base64URL and how does it differ?

Base64URL is a URL-safe variant defined in RFC 4648 §5. It replaces + with - and / with _, and often omits padding. It is used in JWTs, OAuth tokens, and URL parameters where + and / would be percent-encoded.

Can I encode images or binary files?

Yes — use the "Load File" button to select any file. The tool reads it as binary and outputs its Base64 representation. You can then prepend data:image/png;base64, (or the appropriate MIME type) to use it as an inline data URL in HTML or CSS.

Why does the output contain characters not safe for URLs?

Standard Base64 uses +, /, and =, which have special meaning in URLs. If you need to put Base64 data in a URL query string, use Base64URL encoding or percent-encode those characters.