Base64 Encoder & Decoder

Encode plain text or binary files into Base64 format and decode Base64 back into human-readable text with full UTF-8 Unicode support and URL-safe mode.

Free, no sign-upRuns in your browserUpdated November 2026
Encode Local File to Base64 Files are processed 100% locally in browser memory.
Encoded successfully
Input Size
0 B
Output Size
0 B
Size Expansion
+33%
Encoding
UTF-8 / RFC 4648

How to use the Base64 Encoder & Decoder

  1. Toggle the Encode or Decode tab depending on your objective.
  2. Paste your plain text or Base64 string into the Input box.
  3. Enable URL-Safe Base64 if embedding the string in a URL query parameter or JWT token (replaces `+` and `/` with `-` and `_`).
  4. Or select a local image/document using Encode Local File to generate a Base64 data URI.
  5. Click Copy result or Download file to use the output in your code.

The Fundamentals of Base64 Binary-to-Text Encoding (RFC 4648)

Base64 is a binary-to-text encoding scheme designed to transport arbitrary binary data across legacy network protocols and text-only transport layers (such as MIME email bodies, HTTP headers, XML documents, and JSON payloads). In ancient computing standards like ASCII and SMTP, transmitting raw 8-bit bytes frequently caused byte-mangling or command injection because certain control characters (such as null bytes, carriage returns, or escape characters) were reserved by intermediary gateways.

Base64 solves this by mapping every 3 binary bytes (24 bits) into 4 printable ASCII characters (6 bits each) chosen from an alphabet of 64 standard characters:

Base64 Alphabet: A–Z (index 0–25), a–z (index 26–51), 0–9 (index 52–61), + (index 62), / (index 63)
Size Overhead: Output Length = 4 × ⌈Input Bytes ÷ 3⌉ (approx. +33% byte expansion)

Standard Base64 vs. URL-Safe Base64

FeatureStandard Base64 (RFC 4648 §4)URL-Safe Base64 (RFC 4648 §5)
Character 62+ (plus sign)- (hyphen / minus)
Character 63/ (slash)_ (underscore)
Padding Character= (equals sign)Omitted or optional
Primary Use CasesMIME email, Data URIs, Basic Auth headers, PEM certificatesJSON Web Tokens (JWT), URL query parameters, REST API IDs

Why Legacy JavaScript window.btoa Breaks on Unicode

Many basic web tools use JavaScript's built-in window.btoa() and window.atob() functions directly. However, the original browser specification for btoa only accepts Latin1 (ISO-8859-1) characters (byte values 0 to 255). As soon as user text contains an emoji (e.g. 🚀), Cyrillic, Chinese, or Arabic characters, btoa throws an Uncaught DOMException: The string to be encoded contains characters outside of the Latin1 range.

This tool utilizes modern standards-compliant TextEncoder and TextDecoder APIs, ensuring full multi-byte UTF-8 Unicode support without character corruption.

Real-World Engineering Applications of Base64

  • Inline Data URIs: Web developers embed small icons directly inside CSS or HTML (e.g. <img src="data:image/png;base64,iVBOR...">) to eliminate additional HTTP round-trips.
  • HTTP Basic Authentication: Web servers authorize API requests by decoding credentials from the Authorization: Basic <base64(user:password)> header.
  • Cryptographic Keys & Certificates: OpenSSL, SSH public keys, and TLS certificates (PEM files) wrap raw binary ASN.1 structures inside Base64 blocks bounded by -----BEGIN CERTIFICATE-----.

Frequently asked questions

Is Base64 a form of encryption?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string back into plain text in milliseconds. It provides zero confidentiality and should never be used to secure sensitive passwords without real encryption (like AES-256 or RSA).
Why does Base64 increase file size by 33%?
Base64 packs 3 bytes of binary data (24 bits) into 4 text characters (4 × 6 bits). Because each text character requires 8 bits of storage in ASCII, 3 bytes expand to 4 bytes, creating a 4/3 (~33.3%) size overhead.
What do the equal signs (=) at the end of a Base64 string mean?
Equal signs represent padding. Because Base64 groups data into 3-byte blocks, an input whose length is not divisible by 3 receives one or two "=" padding characters at the end so the string length is a multiple of 4.
What is URL-Safe Base64?
In standard Base64, "+" and "/" have special syntactic meanings in URL query strings and path segments. URL-safe Base64 substitutes "-" for "+" and "_" for "/", allowing strings to be used safely in links and JSON Web Tokens.
Are my files or passwords uploaded to a server?
No. All encoding and decoding runs 100% locally on your computer inside your web browser. No text or files are ever sent across the network.
How large of a file can I encode?
Because the operation runs in browser memory, you can comfortably encode files up to 25MB to 50MB (images, fonts, small PDFs, audio clips) without lag.

Last reviewed November 2026. Results are estimates for information only — see our disclaimer.