Skip to content

Base64 Decode and Encode

Decode Base64 to text or encode text to Base64, including URL-safe Base64, in UTF-8, Latin-1 or UTF-16. Runs in your browser: nothing is uploaded.

Runs in your browser

Everything happens on your device: nothing you paste or type is sent to our server or stored. A share link holds your settings, and your input only if you choose to include it.

How text becomes bytes. UTF-8 is what the web, JSON and email use; pick another only to match a system that expects it.

URL-safe Base64 (RFC 4648 §5) is used in URLs, file names and JSON Web Tokens. Decoding reads either.

Pads the output to a multiple of 4 characters. URL-safe Base64 often leaves it out.

More options

Email attachments (RFC 2045) use 76-character lines.

18 characters · 20 bytes (UTF-8) · limit 5 MB

Output: 28 characters.

Input size (bytes)
20
Output length (characters)
28

Method: Base64, RFC 4648 §4 · FindMySum codec (no library), RFC 4648 (2006)

Off by default. When on, your input is packed into the part of the link after “#”, which browsers never send to any server; anyone you give the link to will see it.

How it works

Encoding turns your text into bytes using the character set you pick (UTF-8 unless you change it), then reads those bytes three at a time. Each group of 24 bits becomes four characters from a 64-character alphabet, following RFC 4648 §4. When the last group has only one or two bytes, the output ends with two or one “=” signs so its length is a multiple of four; you can turn that padding off, as many URL and token formats do.

Decoding runs the same steps backwards. It accepts both the standard alphabet (+ and /) and the URL-safe one (- and _) from RFC 4648 §5, skips spaces and line breaks, and stops at the first character that can't be Base64, telling you its position. A length that no byte count could produce, or the wrong number of “=” signs, is an error rather than a guess. Bytes that aren't valid text in the chosen character set are shown as hex, with a download button, because they are probably a file.

Everything runs in your browser with our own code, written from the RFC and checked against its test vectors; there is no library and no upload. The optional 76-character line wrapping follows the MIME rules in RFC 2045 §6.8.

Standards this tool follows

Base64 Decode and Encode: How Base64 Works and When to Use It

By FindMySum · Last reviewed

To base64 decode a string, paste it into the box above with the direction set to decode: the text appears straight away, and nothing you paste leaves your device. Base64 is a way of writing any bytes, such as an image, a certificate or text in any language, using only 64 plain characters that survive email, URLs, JSON and configuration files without being changed along the way.

When you will meet Base64

Base64 shows up wherever binary data has to travel through a system built for text. Email attachments are Base64 inside the message. Data URLs in web pages (data:image/png;base64,...) embed small images directly in HTML or CSS. JSON Web Tokens are three Base64url sections joined by dots. Kubernetes secrets, many API responses and HTTP Basic authorization headers carry Base64 as well. Decoding one of these is usually the first step in working out what a system is actually sending.

How to use the tool

  1. Choose the direction: encode turns text into Base64, decode turns Base64 back into text.
  2. Leave the character set on UTF-8 unless you know the other side uses Latin-1 (older Western European systems) or UTF-16LE (some Windows tools and PowerShell's -EncodedCommand).
  3. When encoding for a URL, a file name or a token, pick the URL-safe alphabet and consider turning padding off.
  4. Copy or download the result. The swap button sends the output back into the input with the opposite direction, which is a quick way to check a round trip.

A worked example

The word Man is three bytes in UTF-8: 77, 97 and 110. In binary that is 01001101 01100001 01101110. Split into four groups of six bits you get 010011, 010110, 000101 and 101110, which are 19, 22, 5 and 46. In the Base64 alphabet those values are T, W, F and u, so Man encodes to TWFu. A two-letter word such as Ma leaves only 16 bits, so the encoder adds two zero bits to make three six-bit groups (TWE) and one = to finish the block: TWE=.

Common mistakes

Treating Base64 as security. It hides nothing. If a configuration file stores a password in Base64, the password is effectively in plain view.

Mixing up character sets. The same text gives different Base64 in UTF-8 and UTF-16LE, and decoding with the wrong one produces garbled characters or an error. When the decoded bytes are not valid text at all, the tool shows them as hex instead of inventing characters.

Breaking the string in transit. Copying from a PDF or a chat app can add spaces, line breaks or curly quotes. Spaces and line breaks are ignored when decoding; any other stray character is reported with its position so you can find it.

Forgetting about padding. Some systems insist on the = signs and others reject them. If a decoder elsewhere complains, try the opposite padding setting when you encode.

For numbers rather than text, the number system converter converts between binary, octal, decimal and hexadecimal, and the data storage converter handles bytes, kilobytes and mebibytes.

Sources

Frequently Asked Questions

Is Base64 a form of encryption?

No. Base64 only changes how bytes are written down, and anyone can reverse it without a key. A password or API key written in Base64, such as an HTTP Basic authorization header, is as exposed as the plain text. Use real encryption, or keep the value secret, if it needs protecting.

Why does my decoded text show strange characters like é instead of é?

The bytes were decoded with a different character set from the one used to encode them. UTF-8 text read as Latin-1 turns é into é. Switch the character set to match the system that produced the Base64; for anything from the web, email or JSON that is almost always UTF-8.

What is the difference between Base64 and Base64url?

They use the same method with two different symbols. Standard Base64 uses + and /, which have special meanings in URLs and file names, so Base64url (RFC 4648 §5) uses - and _ instead and usually drops the = padding. JSON Web Tokens use Base64url. This tool decodes either one automatically.

How much bigger does Base64 make a file?

Base64 output is four characters for every three bytes, so it is about 33% larger than the original, plus a little more for padding and line breaks. A 3 MB image becomes roughly 4 MB of Base64 text, which is why embedding large images as data URLs slows pages down.

Spotted a wrong result or a bug? Report a problem (the link sends the page address only, never what you entered).

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy