Base64 Encode/Decode

Encodes text or an uploaded file to standard Base64 and decodes it back, converting Unicode to UTF-8 first and accepting MIME input with line breaks. Swap reverses direction; local only.

Last updated:

Enter text to encode...
Loading editor...
Loading editor...

Base64 Encoder & Decoder — Encode and Decode Base64 Online

Understanding the Basics

Base64 is a binary-to-text encoding scheme that represents arbitrary binary data using only 64 printable ASCII characters: uppercase letters A–Z, lowercase letters a–z, digits 0–9, plus (+), and slash (/), with equals (=) used as padding. The encoding works by reading input bytes in groups of three (24 bits), splitting each group into four 6-bit values, and mapping each 6-bit value to one of the 64 characters using a lookup table. The resulting text is always 33% larger than the binary input but is guaranteed to contain only characters safe to transmit in text-based protocols. Base64 was formalized in RFC 4648 and is ubiquitous across computing: email attachments (MIME), data URIs in HTML/CSS (data:image/png;base64,...), TLS certificates (PEM format begins with "-----BEGIN CERTIFICATE-----" followed by Base64), JSON Web Tokens (JWTs use Base64URL), HTTP Basic Authentication headers, SSH public keys, and SAML assertions all use Base64. URL-safe Base64 (Base64URL) replaces + with - and / with _ to avoid conflicts with URL characters. Our tool supports both standard Base64 and Base64URL variants, handling all Unicode input by first encoding to UTF-8 bytes before applying Base64.

How to Use the Tool

  1. Select the mode: "Encode" to convert text or binary to Base64, "Decode" to recover the original from Base64.
  2. Paste your input text into the input field. For Unicode text, UTF-8 encoding is applied automatically before Base64 encoding.
  3. The encoded or decoded result appears instantly in the output panel.
  4. Use the file upload to encode binary files.
  5. Copy the result with the Copy button or download it as a text file.

Key Features & Specifications

  • Encodes Standard Base64 and decodes UTF-8 text
  • Handles full Unicode input by encoding to UTF-8 bytes before Base64 encoding
  • Standard Base64 output includes padding when required
  • Accepts Base64 input with or without line breaks (MIME-formatted Base64)
  • 100% browser-side: sensitive certificates, keys, and tokens never leave your machine

Frequently Asked Questions (FAQ)

Q:Is Base64 a form of encryption or security?
No. Base64 is purely an encoding scheme — it adds zero security. Anyone with the Base64 string can trivially decode it back to the original data in milliseconds. Never use Base64 as a substitute for encryption; use it only to safely transmit binary data through text-only channels.
Q:What is the difference between Base64 and Base64URL?
Standard Base64 uses + and / characters which are reserved in URLs and can cause parsing issues in query strings and path segments. Base64URL replaces + with - and / with _ to produce URL-safe strings. JWT tokens use Base64URL and typically omit padding (= signs).
Q:Why does my decoded Base64 output look like gibberish?
If your Base64 string encoded binary data (like an image, PDF, or compressed file) rather than UTF-8 text, decoding it to text will produce unreadable bytes. Base64 encoding a PNG image produces a string that decodes back to raw PNG binary bytes — not human-readable text.
Q:Why is Base64 encoded text always longer than the original?
Base64 represents every 3 bytes of input as 4 ASCII characters (a 4/3 overhead ratio). A 3-byte group (24 bits) is split into four 6-bit groups, each mapping to one Base64 character. This produces approximately 33% size inflation compared to the original binary data.