TheFileTools

How to decode a Base64 string back into text

Read what a Base64 value contains, including URL-safe and unpadded strings, and what to do when decoding fails.

Base64 strings turn up in HTTP headers, configuration files, email sources and API responses. They look like random letters, but they are ordinary data in a different spelling, and decoding shows what is inside.

Steps

  1. Open Base64 decode.
  2. Paste the Base64 string.
  3. Read the text in the result box, or press Copy.

For example, SGVsbG8sIHdvcmxk decodes to Hello, world. Decoding happens in your browser. That matters here, because Base64 values are often credentials: the part after Basic in an Authorization header is a user name and password in Base64, readable by anyone who sees it.

What input is accepted

  • Line breaks and spaces are ignored, so a value wrapped over several lines can be pasted as it is.
  • The URL-safe alphabet, which uses - and _ in place of + and /, is understood.
  • Missing padding is repaired. Y2Fmw6k decodes to café with or without the final = sign.
  • A data: prefix, as in data:text/plain;base64, followed by the value, is removed automatically.

When you get "This is not valid Base64 text."

There are two different causes. The first is a damaged string: a character that does not belong to the alphabet, or a piece cut off while copying. Copy the value again, without surrounding quotes.

The second is that the string is valid Base64 but does not contain text. The tool shows the result as UTF-8 text and refuses bytes that are not valid UTF-8, so an encoded image, PDF or compressed data cannot be displayed. The tool does not turn Base64 back into a file.

Related tools

A JSON Web Token is three Base64 parts joined by dots. Do not split it by hand: JWT decoder reads the header and payload and shows the expiry time. If the decoded text turns out to be one long line of JSON, paste it into JSON formatter. To go the other way, use Base64 encode.