Free online tool

Base64 Encoder / Decoder

Convert between plain text and Base64 with full Unicode support — instantly, offline.

What Base64 is for

Base64 is an encoding scheme that turns arbitrary binary data — or text containing characters that would confuse a transport layer — into a safe ASCII string made of 64 well-behaved characters. It's what powers embedded images in HTML data URIs, JWT tokens, email attachments, and countless configuration files that need to smuggle binary blobs through text-only channels.

Encoding and decoding correctly

A common trap with Base64 is Unicode. The native browser btoa only handles Latin-1 characters, so encoding a string like "café" directly will throw an error. This tool wraps the browser API with a UTF-8 conversion step so emoji, accented characters, and non-Latin scripts all round-trip correctly. Everything happens locally — even sensitive tokens are safe to paste here.

+Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone with the encoded string can decode it. Never use it to hide passwords or secrets.

+Why is my Base64 result about 33% longer than the input?

Base64 uses 4 characters to represent every 3 bytes of input, so encoded output is always roughly 4/3 the size of the original.

What Base64 actually buys you (and costs you)

Base64 isn't encryption and isn't compression — it's a reversible mapping from arbitrary bytes to a 64-character alphabet so binary data can survive being pasted into text-only channels like JSON fields, email headers, or URL query strings.

It shows up constantly in places developers don't expect: embedded images in CSS, attachments in MIME email, Basic Auth headers, and the header and payload segments of a JWT. Understanding its overhead and its limits helps you decide when it's the right tool and when you're just adding bytes for no benefit.

The 4/3 overhead nobody warns you about

Every 3 bytes of input become 4 output characters, a fixed 33% size increase, plus up to two padding equals-signs at the end to fill out the last group. Embed a 1MB image as a Base64 data URI and you're shipping roughly 1.37MB over the wire — fine for a small icon, wasteful for anything larger, which is why most CDNs prefer raw binary with proper content-type headers instead.

Standard alphabet versus URL-safe alphabet

The classic alphabet uses + and / as its 63rd and 64th characters, both of which have special meaning inside a URL. The URL-safe variant swaps those for - and _ so the string can sit in a query parameter or path segment without percent-encoding. Decoding the wrong variant with the wrong tool is a common source of silent corruption, since a stray + can get interpreted as a space by some URL parsers.

One thing worth remembering

Because Base64 is just an encoding, anyone can decode it in one line of code — it provides zero confidentiality. If you see a JWT payload or a config secret Base64-encoded, treat it as plaintext for security purposes, not as obfuscation, and never rely on it as a substitute for actual encryption before storing something sensitive.

Padding rules and why '==' sometimes disappears

Padding exists purely to make the output length a multiple of 4, and its presence depends on the input length modulo 3: no remainder means no padding, a remainder of 1 means two equals signs, a remainder of 2 means one. Some systems, particularly URL-safe implementations used in tokens, drop padding entirely and reconstruct it at decode time by computing the expected length, which is why you'll sometimes see a valid Base64URL string with no trailing equals signs at all.

Decoding binary versus decoding text

Decoding a Base64 string always produces raw bytes; whether those bytes represent readable text, a PNG, or a zip archive depends entirely on what was encoded in the first place. Pasting an image's Base64 string into a tool that assumes UTF-8 text output will show unreadable characters, which is expected — you need a tool that lets you save or view the decoded bytes as binary, not force them through a text decoder.

People also search for

  • base64 encode decode online
  • base64 to image converter
  • url safe base64
  • base64 decode text
  • convert file to base64
  • base64 encoding explained
  • base64 padding rules
  • jwt base64 decode