Base64 Encode and Decode Online

Convert text or files to Base64 and back again. Pick a character set, use URL-safe Base64, and download decoded files, all in your browser.

What Is Base64?

Base64 is a way of writing any data, such as text, an image or a file, using only 64 safe characters: the letters A to Z and a to z, the numbers 0 to 9, plus "+" and "/". Because the result is plain text, it can travel through systems that were designed for text only, such as email, web forms, JSON and URLs, without being damaged.

How Base64 Encoding Works

Three bytes become four characters

Computers store data as bytes. Base64 takes the bytes three at a time, which is 24 bits, and splits them into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, and each number maps to one character of the Base64 alphabet. For example, the text "Man" becomes TWFu, "Hello" becomes SGVsbG8= and "Lumara" becomes THVtYXJh.

Padding and size

When the data does not divide into groups of three bytes, one or two "=" signs are added at the end so the length is a multiple of four. Because three bytes become four characters, Base64 is about one third larger than the original data, and more if you add line breaks.

How to Use the Base64 Encoder and Decoder

  1. Choose Encode to turn text into Base64, Decode to turn Base64 back into text, or File to Base64 to convert a file.
  2. Type or paste your input. With live mode on, the result appears as you type. Turn it off and use the button if you work with very large inputs.
  3. Set the character set if you need something other than UTF-8.
  4. Use Treat each line separately to convert a list of values, one per line.
  5. Press Copy result, or Download result to save it as a .txt file.

Need something to practice with? Generate sample text with the Lorem Ipsum Generator, paste it in, and watch how the output grows.

If you paste Base64 that decodes to a picture or another file instead of text, the decoder detects common types such as PNG, JPEG, GIF, WebP and PDF and offers a download button, with a preview for images.

Choosing the Right Character Set

Base64 works on bytes, not on letters, so text must first be turned into bytes using a character set. The default, UTF-8, can represent every language and emoji and is what most modern systems use. Other options are included for older data: ASCII covers basic English letters, ISO-8859-1 and Windows-1252 cover Western European languages, and UTF-16 is used by some Windows software.

The character set must match on both sides. If you decode with a different set than the one used to encode, accented letters and symbols turn into the wrong characters. Files and images are not text, so they do not use a character set at all.

URL-Safe Base64

The "+" and "/" characters have special meanings in web addresses. A variant called Base64URL, defined in RFC 4648, replaces them with "-" and "_" and usually drops the "=" padding. Switch on URL-safe Base64 when the result will go into a link, a file name or a token. The decoder accepts both forms. For general link encoding, see the URL Encoder/Decoder.

Where Base64 Is Used

Base64 Is Not Encryption

Base64 only changes how data is written. Anyone can decode it, with no key or password, so it does not protect secrets. Basic authentication headers, for example, are only safe when sent over HTTPS. Use real encryption for anything private.

Troubleshooting

Planning to share a long link to a demo or test page that shows your result? A short link is easier to send. The free URL shortener from Lumara Links makes one in seconds, but do not shorten links that contain tokens, keys or other secrets.

Worked Examples

Frequently Asked Questions

What is Base64 used for?

It lets binary or special-character data travel safely as plain text, for example in email, data URIs, web tokens and APIs.

Is Base64 encryption?

No. It is an encoding that anyone can reverse. It offers no security.

Why does Base64 end with an equals sign?

The "=" is padding. It brings the length up to a multiple of four when the data does not divide evenly into three-byte groups.

Why is the Base64 output larger than the input?

Three bytes become four characters, so the output is about 33 percent larger.

Can I decode Base64 into an image or a PDF?

Yes. Paste the Base64, with or without the data URI prefix, into the Decode tab. If it is a recognized file type, a download button appears.

Does it support Arabic, accents and emoji?

Yes, when you use UTF-8, the default character set.

What is the largest file I can convert?

The File to Base64 tab accepts files up to 20 MB.

Is my data uploaded or saved?

The conversion runs in your browser. The tool does not upload or save your text or files. The page also loads a cookie banner and an advertisement from third-party services, described in our Privacy Policy. Do not paste passwords or secrets into any online tool you do not trust.

Related Tools and Guide