Cookies This site keeps only what it needs to work. There is no analytics and no advertising on it today, and nothing here follows you to other sites. Read the privacy policy

Choose what to allow
+92 312 8299940Free Quote
EN – Language: English
Free tool, nothing to install

Base64 Decode and Encode
Text, Images and Whole Files

Paste a string to base64 decode it, or type plain text to encode it. The output refreshes with every key you press. Emoji and accents come through intact, and a file never leaves your device.

  • FreePrice
  • 25 MBLargest file
  • 2Alphabets
  • NoneUploads

Base64 Encoder and Decoder

Text or files in, Base64 out, and back again

Input
0 B
Output
0 B
Change
—

Ready. Type some text, paste Base64, or open a file.

Your browser does all of the work here, in this tab. We upload nothing, store nothing and log nothing.
Add a link to this tool on your own site

Copy the code below and drop it into your page. It places a link to this free tool.

Guides for this tool

Articles with worked examples, tables and a short video that help you get more from this tool.

The short version

What Base64 Decode And Encode Actually Do

Base64 changes any bytes into 64 safe characters: letters, digits, plus and slash. So a picture, a key or a zip archive can travel through systems that only accept plain text.

Base64 decoding of these types of strings results in returning the original byte representation of that string.

Nothing about the process is secret, though. Anyone with a base64 converter can read the result, which is why the format protects nothing on its own.

The rules are older than the web, and they have not moved. RFC 4648, which defines Base64 spells out the alphabet this page uses.

How Three Bytes Turn Into Four Base64 Characters

The encoder takes your data in groups of three bytes, which is 24 bits per group. It then cuts those bits into four groups of six, and each group picks one of the 64 characters.

Diagram of Base64: the 24 bits of Man regrouped from three 8-bit groups into four 6-bit groups, giving TWFu
Base64 turns each group of three bytes into four printable characters.

The use of four characters to represent three bytes results in an increase of about one-third in the length of encoded text compared with the original text. Thus, a 300 KB image will be about 400 KB of text after encoding.

Adding a line break increases the total character count by a small amount. Base64 is typically divided into lines of 76 characters when sent through email. Because of this, the tool gives the option to have the text formatted in that manner as an alternative to forcing you to format it yourself.

The Reason Some Encoded Strings End in = Signs

Real data seldom ends on an exact multiple of three bytes. When one byte remains at the end, the encoder writes two characters and adds ==. When two bytes remain, it adds a single = instead.

Base64 encoder result TWE= for two input letters, with the equals sign at the end of the result highlighted
Two letters leave one gap, so one equals sign fills it.

Only the last block has padding, so if there is an equal sign in the middle of your string, you have combined two strings. This decoder will return a name for the location of the combination rather than garbage.

The URL-Safe Alphabet

Inside of a URL there are two characters, plus and slash. So, RFC 4648 defines an alternate alphabet that replaces the plus and slash with a minus and an underscore. Many token generators will also remove the padding from the end of the string. You can select URL-safe if you want to use this method to encode. Both of the alphabets can be used to decode without needing to switch between them.

Base64 encoder with the URL-safe alphabet, using an underscore and a hyphen instead of a slash and a plus sign
The URL-safe alphabet swaps two symbols that break links.
Video guide

A Quick Walkthrough of the Base64 Encoder and Decoder

This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.

How it works

How To Base64 Decode Or Encode In Four Steps

None of these steps ask you to make an account or upload anything. Many users will complete this process by completing only the first two steps.

  • Choose a direction

    Leave the menu on Encode to turn text into Base64, or switch it to Decode to read a string back.

  • Type it in, paste it, or open a saved file

    Press Open a file, or type into the left box. The file will convert into Base64 by byte, so nothing within the file is changed.

  • Adjust the output

    Turn off the padding of each token, use line breaks when sending emails, and create a Data: URI from any file to be used with CSS and HTML.

  • Copy, save or swap

    Copy the results, download the results, or click Use as Input to run the job backwards to work out if there were issues with the round-trip.

Why this one

What This Base64 Decoder Handles For You

Most conversion tools use only two of the browser’s functions, and they are unable to process any emojis before failing. So, this tool can correctly perform the task.

  • Real UTF-8, not Latin-1

    The browser btoa() function fails on any character beyond Latin-1. Here your text becomes UTF-8 bytes first, so Urdu, Chinese and emoji all survive.

  • Binary stays binary

    When a decoded byte stream forms a PNG, JPEG, GIF, PDF or zip file, the software will inform the user. The software then gives a option for the user to download the file rather than displaying illegible characters on the screen.

  • Forgiving about input

    Line breaks, whitespace, lack of padding and a "data:" prefix at the beginning will be handled without any warning or error. Only actual invalid data strings cause errors.

  • Errors with a position

    The location of a stray character will be reported as part of your report so that you may easily locate the incorrect copy and paste within seconds.

  • Live size figures

    Input size, output size and the change in percent sit under the result. So you can see the one-third growth before you inline an image.

  • Your data stays here

    Base64 is used to hide tokens and keys. Your browser performs all of the steps, so no text will ever reach our servers or any other party.

Good habits

Habits That Save A Debugging Session

Base64 appears to be random data, which makes errors in the data very difficult to spot. But, these practices make the errors obvious early on.

  • Treat it as public. Anyone can reverse Base64 in a second. If a value needs protection, encrypt it first and encode the ciphertext afterwards.
  • Match the alphabet to the job. Use the standard character set for email and data URIs. For query string parameters, file name parameters, and token parameters, use the URL safe character set.
  • Check the round trip. Once you’ve finished encoding your important data, select "Use as Input," then decode your encoded data. If the decoded data is identical to your original data, then the entire string has been processed.
  • Think twice before inlining images. A data URI saves one request but adds a third to the size, and the browser cannot cache it separately. Keep inlining for small icons.
  • Copy the whole string. Terminals and chat applications often truncate long lines of text. A short paste can explain why a decode failed when it occurred at or near the end of a line.
  • Name the character set. Base64 carries bytes, not letters. So when you hand encoded text to another system, tell it the bytes are UTF-8.
Worth avoiding

Three Base64 Mistakes We See Often

These three are all fine during a quick check but they each fail during actual use, typically when you need them most.

  • Calling it encryption

    A base64-encoded password is equivalent to a plain text password. Any user that can view the encoded string can also decode it.

  • Using btoa() on user text

    The code will pass all the tests for English, but will fail when it comes to the first customer name with an accent. Before anything else is done, turn the text into UTF-8 bytes.

Questions

Base64 Questions People Ask

What steps turn a Base64 string back into text on Denwix?

You can switch your direction menu to Decode and enter the string in the left box. The original text shows up on the right side straight away. If those bytes represent an image or document you can click on the download button instead.

Does Base64 encoding keep data secret?

No. It has no key and no secret, so anybody can reverse it instantly. It exists to carry bytes through text-only channels, while encryption exists to keep them private.

Why does the decoded Base64 show strange symbols instead of words?

Usually the original was not text in any form, such as a zipped file or a photograph. If it was, then it used a different character encoding scheme than UTF-8 that is required for readable output from this tool.

How does URL-safe Base64 differ from the standard alphabet?

Just two characters differ. The URL safe version uses a "minus" (-) instead of a "plus" (+), and an "underscore" (_) instead of a "slash" (/), since both will pass through the URL as well as the file name.

Can I base64 encode an image for CSS?

Yes. Open the image, turn on Files as a data: URI, and paste the result into a url() value. Keep it for small images, since each one grows by about a third.

Do my files or strings get uploaded?

No. The page sends nothing while you work. Your browser reads the file, converts it in memory and hands the result back, so tokens and private files stay on your device.

More free tools

Handy Companions for This Encoder

Decoded data often needs a second step. These three cover the usual ones, and none of them asks for an account.

Ready To Convert Your String?

Paste it, pick a direction, and copy the answer. The base64 decode or encode takes a moment, costs nothing, and stays inside this tab.

Prefer Denwix on GoogleReview Denwix on Google