🔐 Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 strings back to plain text instantly. Supports full Unicode. 100% browser-based — nothing sent to any server.

FreeNo LoginBrowser-BasedPrivate

What is Base64 Encoding?

Base64 is an encoding scheme that converts binary data into a string of printable ASCII characters. It was developed as part of the MIME (Multipurpose Internet Mail Extensions) standard in the 1990s to solve a specific problem: many communication systems — email servers, HTTP headers, XML documents — were designed to handle only plain text. Base64 provides a reliable way to represent any binary data (images, files, binary protocols) as a text string that can pass through these systems unmodified.

The "64" in Base64 refers to the 64 printable characters used: uppercase A–Z (26), lowercase a–z (26), digits 0–9 (10), and the symbols + and / (2). Every 3 bytes of binary input are encoded into 4 Base64 characters, which means Base64-encoded data is approximately 33% larger than the original. This size increase is the trade-off for universal text compatibility.

Base64 is not encryption. It provides no security — anyone can decode a Base64 string without a key. Its purpose is safe text representation, not data protection. A common and dangerous mistake is using Base64 to "hide" passwords or API keys in source code. This provides no security whatsoever.

How to Use This Base64 Tool — Step by Step

  1. To encode: Paste any plain text into the Input box → Click "🔒 Encode to Base64" → Copy the Base64 string from the Output box.
  2. To decode: Paste a Base64 string into the Input box → Click "🔓 Decode from Base64" → The original text appears in the Output box.
  3. Use "⇅ Swap" to move the output back to the input for chained operations.
  4. Unicode support: This tool handles emoji, Arabic, Chinese, Urdu, and all non-Latin scripts using UTF-8 encoding under the hood.

Where Base64 Is Used — Real-World Examples

  • Email attachments (MIME): Every file attachment in an email is Base64-encoded before transmission and decoded by your email client on receipt.
  • HTTP Basic Authentication: The Authorization: Basic header sends username:password as a Base64 string — e.g., Authorization: Basic dXNlcjpwYXNz.
  • JSON Web Tokens (JWT): The header and payload sections of a JWT are Base64URL-encoded (a URL-safe variant). Paste any JWT into the decode box to read its contents.
  • Embedding images in HTML/CSS: Small icons and logos can be converted to Base64 data URIs — src="data:image/png;base64,iVBOR..." — eliminating an HTTP request.
  • API payloads: Binary data (PDFs, images) sent through JSON APIs must be Base64-encoded since JSON only supports text values.
  • Storing binary in databases: Some database fields store images or binary files as Base64 text in VARCHAR columns.

Base64 vs Base64URL — Key Differences

Feature Standard Base64 Base64URL
Character 62+ (plus)- (hyphen)
Character 63/ (slash)_ (underscore)
URL safe?❌ No (+ and / need escaping)✅ Yes
Padding (=)RequiredUsually omitted
Used inEmail, general encodingJWTs, OAuth tokens, URLs

Frequently Asked Questions

What is Base64 encoding?

Base64 converts binary data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It was designed to safely transmit binary data through systems that only handle text — like email, HTTP headers, and JSON/XML. Base64 increases data size by ~33% but ensures compatibility with any text-based system.

What is Base64 used for in practice?

Primary uses: email attachments (MIME encoding), HTTP Basic Auth headers, JWT token structure, embedding images as data URIs in HTML/CSS, sending binary files through JSON APIs, and storing binary data in text-only database fields.

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. Anyone can decode it without a key — it provides zero security. A dangerous and common mistake is using Base64 to hide passwords or API keys. Use proper encryption (AES, RSA) for sensitive data. Use Base64 only for safe text representation of binary data.

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and / which need percent-encoding in URLs. Base64URL replaces + with - and / with _ to produce URL-safe strings. JWTs use Base64URL. If you see Base64 in a URL, it is likely Base64URL.

Why does Base64 output end with == sometimes?

Base64 encodes 3 bytes at a time into 4 characters. If the input is not a multiple of 3 bytes, = padding is added. One = means 1 byte of padding; == means 2 bytes. Padding ensures the output length is always a multiple of 4 characters, which some decoders require for correct operation.

Related Tools