Base64 Encoder/Decoder

Encode text to Base64 or decode Base64 back to text. Handles Unicode correctly. Works entirely in your browser with no uploads.

Your data stays in your browser. Text is processed locally and is not uploaded to DevPouch.

Input Text or Base64

0Characters
0Lines
0 BSize

Paste or type text. Choose Encode or Decode above.

Awaiting input…

Output Result

0Characters
0Lines
0 BSize

How it works

1

Select Mode

Choose Encode to convert text to Base64, or Decode to convert Base64 back to text.

2

Paste Payload

Enter plain text (for encoding) or a Base64 string (for decoding). The tool handles Unicode, emojis, and whitespace automatically.

3

Copy or Download

Click Copy to copy the result to clipboard, or Download to save as a .txt file.

Technical Deep Dive

Why standard btoa() fails on Unicode

The native btoa() and atob() functions only accept Latin-1 (ISO-8859-1) strings. When you pass multi-byte characters like emojis (🎉), Chinese/Japanese/Korean text, or any character outside the 0-255 range, they throw a DOMException: The string contains characters outside of the Latin1 range.

This tool solves that by first serializing the input to UTF-8 bytes using TextEncoder, then encoding those bytes to Base64. For decoding, it decodes Base64 to bytes, then uses TextDecoder to reconstruct the original Unicode string. This round-trips correctly for all valid Unicode code points.

// What browsers do (fails on emoji)
btoa("🎉"); // DOMException

// What this tool does (works)
const bytes = new TextEncoder().encode("🎉");
const base64 = btoa(String.fromCharCode(...bytes));
// Result: "8J+Riw=="

Standard Base64 vs Base64URL

Standard Base64 (RFC 4648 §4) uses A-Z, a-z, 0-9, +, and /, with = padding. These characters have special meaning in URLs and JSON:

  • + and / are reserved in URL paths and query strings
  • = padding can be confused with query separators

Base64URL (RFC 4648 §5) is a URL-safe variant:

  • Replaces + → - (minus)
  • Replaces / → _ (underscore)
  • Omits = padding entirely

This makes Base64URL safe for JWTs, URL parameters, filename tokens, and cookie values without additional escaping.

// Standard Base64
"SGVsbG8gV29ybGQh" // Contains no special chars (lucky case)
"PGh0bWw+"         // Contains + — unsafe in URLs

// Base64URL
"SGVsbG8gV29ybGQh" // Same (no special chars)
"PGh0bWw-"         // + replaced with - — URL-safe

Frequently Asked Questions

Reserved for AdSense (Horizontal)

Base64 encoding represents binary data as plain ASCII text using a fixed 64-character alphabet, which lets images, files, and credentials move through systems that handle only text. The DevPouch Base64 Encoder/Decoder is a free, online developer utility for encoding plain text into Base64 or decoding Base64 strings back into their original content. Because every operation runs entirely in your browser, no data is uploaded to a server, nothing is stored externally, and sensitive material stays on your machine. It is a reliable client-side alternative to server-based converters that risk leaking private payloads.

Use Cases

Common use cases include embedding small images in HTML or CSS as data URIs to reduce HTTP requests, encoding username and password pairs for Basic Authorization headers in API requests, and passing binary payloads through JSON, email headers, or URL query strings without corruption. Developers also use it to decode opaque tokens, JWT segments, and legacy data exports while debugging, to store configuration blobs in text-based formats, and to preserve byte integrity across incompatible systems. It is especially useful for moving image assets, authentication material, and binary configuration through text-only transports.

How To Use the Base64 Encoder Decoder

  • Open the Base64 Encoder/Decoder tool and paste plain text, or upload a file through the file picker.
  • Choose Encode to transform the input into a Base64 string.
  • Copy the encoded result and paste it into source code, authorization headers, or data URIs.
  • To reverse the operation, paste an existing Base64 string into the decode input field.
  • Choose Decode to recover the original text, or download the decoded file to your device.
  • Compare the decoded output with the source before deploying changes to production.
  • Clear both fields and start over with the Reset button when testing multiple values.

Because all encoding happens client side, confidential payloads such as API keys and user data never leave your computer, which makes this utility safe for ad hoc work. It requires no installation, no registration, and no external dependencies, so it fits naturally into frontend development, continuous integration scripts, and quick debugging sessions. Use it whenever binary content must travel through a text-only channel without loss or corruption, and pair it with DevPouch tools like URL encoder and JSON formatter for complete payload handling.