Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 back to plain text, with URL-safe support.
About the Base64 Encoder/Decoder
Base64 is a scheme for representing arbitrary binary data as plain ASCII text, using a 64-character alphabet (A-Z, a-z, 0-9, and two symbols). It works by reading input three bytes (24 bits) at a time and splitting those 24 bits into four 6-bit chunks, each of which maps to one alphabet character — that's why encoded output is always about a third longer than the original text. It exists because many older protocols (email, some URL query strings, JSON when you don't want raw bytes) only reliably carry printable ASCII, so binary-ish content gets wrapped in Base64 to pass through safely and is unwrapped on the other end.
This tool encodes and decodes entirely with the browser's built-in UTF-8-aware routines, so accented letters and emoji round-trip correctly rather than getting mangled — a common bug with naive Base64 implementations that only handle single-byte characters.
To use it: switch to Encode or Decode with the toggle buttons, paste your text or Base64 string into the left box, and the right box updates as you type. Turn on URL-safe if the result needs to live inside a URL — it swaps the standard alphabet's + and / for - and _ and strips trailing = padding, since those characters otherwise need percent-escaping in a URL. For example, encoding the text Hi! produces SGkh in standard Base64: the bytes H (72), i (33), ! (33) become the bit stream 01001000 01101001 00100001, regrouped into four 6-bit values 010010 000110 100100 100001 — 18, 6, 36, 33 — which map to S, G, k, h in the Base64 alphabet.
What is URL-safe Base64?+−
It replaces "+" and "/" with "-" and "_" and drops padding "=" characters, so the result can be used directly in a URL without escaping.
Why does encoded text end with one or two "=" signs?+−
Base64 packs input into groups of 3 bytes and emits 4 characters per group. When the input length isn't a multiple of 3, the last group is padded with "=" so the decoder knows exactly how many bytes to drop.
Why is the Base64 output longer than my original text?+−
Base64 trades file size for transportability: 3 raw bytes become 4 ASCII characters, so encoded output is always about 33% larger than the input.
Can I encode or decode binary files, not just text?+−
This tool works on text strings typed or pasted into the box. Binary data (images, PDFs) is technically base64-able too, but you'd need to convert it to a text representation first — this tool is built for text/URL use cases.
Why do I get garbled characters when decoding?+−
That usually means the input wasn't valid Base64 for the mode you're in — check that URL-safe is toggled to match how the string was originally encoded, and that no whitespace or line breaks were accidentally included.
Is Base64 encryption?+−
No. Base64 is a reversible encoding, not encryption — anyone can decode it instantly with no key. Never use it to hide sensitive data; use it only to safely transport binary-ish text through systems that expect plain ASCII.