Skip to content
DeviceCheckHub

Base64 Encode and Decode

Turn text or a file into Base64, or turn Base64 back into text, a file or a picture. It all happens in your browser.

Type or paste text, or open a file, and its Base64 appears here. Nothing is uploaded.

How to encode and decode Base64

  1. Choose Encode to Base64 to turn text or a file into Base64, or Decode from Base64 to turn it back.
  2. Type or paste into the left box. To encode a file, press Open a file or drag a file onto the box; the file can be up to 10 MB. The result updates as you type.
  3. When decoding, text appears as text. If the Base64 holds a picture, the picture is shown. Anything else is shown as its first bytes in hexadecimal, and you can download it.
  4. Press Copy result or Download. Use result as input flips the direction so you can check a round trip.

What Base64 is, and what it is not

Computers store everything as bytes, but many places that carry data, such as email, JSON files, web addresses and configuration files, are built for text and can mangle other bytes. Base64 solves this by writing any data using only 64 safe characters: the letters A to Z and a to z, the digits 0 to 9, and two symbols (+ and / in the standard form). Three bytes of data become four characters, and one or two = signs at the end pad the last group when the data does not divide evenly by three.

Base64 is an encoding, not encryption. There is no key and no secret: anybody can decode it in a second, with this page or with built-in tools. Passwords, tokens and private data are not protected by being in Base64. Treat a Base64 string as if it were the readable data itself.

The encoding options

Text is always converted to bytes as UTF-8 before it is encoded, which is what nearly every modern system expects. Accented letters, other alphabets and emoji all survive a round trip.

What the decoder accepts

The decoder is forgiving about the way the text was written. It ignores spaces, tabs and line breaks, reads both the standard and the URL-safe characters, adds missing = padding, and removes a data:…;base64, start if you pasted a whole data URL. When something is wrong it says which character is the problem and where it is, instead of just saying “invalid”.

The most common causes of an error are a character that does not belong, such as a quotation mark or bracket copied along with the text, a % code that means the text was URL-encoded and needs decoding first, a text that was cut short, and text that mixes the standard and URL-safe characters.

Base64 to a file or a picture

When the decoded bytes are not text, the tool recognizes the common file types by their first bytes. PNG, JPEG, GIF and WebP pictures are shown on the page, and you can download them with the right file extension; PDF and ZIP files are named as such. Other data is shown as a hex dump, the way a developer would inspect it, and can be downloaded as a .bin file. Going the other way, you can open any file up to 10 MB and get its Base64 text, for example to put a small image directly into a web page or a JSON message.

Where you will meet Base64

Tips

Your data stays on your device

Some Base64 sites send text to a server, or upload files and delete them later. This page does neither: the conversion runs in your browser, for text and for files, so nothing is sent anywhere. The page remembers your latest text and settings in your browser on this device, so they are still there after a reload. Clear removes the text, and clearing the site’s data in your browser removes everything.

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 only changes how data is written so that it can travel through systems that handle plain text. Anyone can turn it back into the original with a tool like this one, so never use it to hide a password or any secret.

Is my text or file uploaded?

No. Encoding and decoding both happen in your browser, for text and for files, so nothing you paste or open is sent to this website or anywhere else. The page keeps the text you typed and your settings on this device so they survive a reload; press Clear to remove the text.

Why does Base64 make my data bigger?

Base64 writes every 3 bytes of data as 4 characters, so the result is about one third (33%) larger, plus a little more if you choose the 76-character lines. That is the price of being able to put binary data, such as a picture, inside text such as an email, a web page or a JSON file.

What is URL-safe Base64?

Standard Base64 uses the characters + and /, which have special meanings in web addresses and file names. The URL-safe form, also called Base64URL, uses - and _ instead and often leaves off the = padding. It is what JSON Web Tokens (JWT) use. The decoder reads both forms without being told which one you have.

Why does decoding show a hex dump instead of text?

The decoded bytes are not valid text, so they are probably a file such as a picture, a PDF, a ZIP archive or compressed data. The page shows the first bytes as hexadecimal numbers beside their characters and offers a download. If it is a picture, you see the picture itself.

My Base64 text fails to decode. What should I check?

The message gives the position of the first wrong character. The usual causes are a character that is not part of Base64 (such as a quotation mark, a % code or a stray bracket copied along with the text), text that was cut off so a character is missing at the end, and = padding signs in the middle instead of at the end. Spaces and line breaks are fine; they are ignored.

Last updated · About DeviceCheckHub