Base64 decoder

5 of 2 ratings
Base64 decoder

Base64 decoder is a free tool that recovers the original data from Base64-encoded input.

What is Base64 encoding and why is it used?

Base64 is a way of representing binary data with a restricted set of printable text characters. It exists because some systems are designed to carry text safely but cannot reliably handle arbitrary bytes.

Standard Base64 draws on uppercase and lowercase letters, digits, the plus sign and the forward slash. An equals sign may appear at the end as padding. Encoding increases the size of the data because every three input bytes become four Base64 characters.

Base64 is encoding, not encryption. Anyone who has the encoded value can decode it without a password or secret key, so it provides no confidentiality. Do not treat a Base64 value as a safe place for passwords, API keys or personal information.

Diagram showing text passing through the Base64 decoder in both directions

How do I use the Base64 decoder?

Paste a Base64 value into the tool and decode it, then read the result in the Base64 decoded field. The server uses PHP's base64_decode function to perform the conversion.

The input travels to the server over HTTPS and is not stored. The work is done on the server rather than solely in your browser, so avoid submitting sensitive material unless you are permitted to send it to an external service.

Base64 preserves bytes rather than meaning. Numbers, spaces and punctuation are simply part of the original byte sequence. Accented letters and non-Latin scripts can also be encoded, but the decoded bytes must be interpreted using the correct character encoding, usually UTF-8 for modern web content.

The Base64 decoder tool on digily.link, showing its input form

Worked examples and format choices

A small standard Base64 example is:

Input: SGVsbG8=

Output: Hello

The final equals sign is padding. It helps complete a four-character Base64 block and does not represent an extra character in the decoded result.

There are two common alphabet variants:

  • Standard Base64 uses + and /. It is common in MIME email, data URIs and many JSON-based APIs.
  • Base64url uses - and _ instead. It is intended for URLs, query parameters and tokens where + and / may be inconvenient. Padding is often omitted.

Choose the variant required by the system that produced the value. A standard decoder may misread or reject Base64url input unless the alphabet is converted first. If you need to reverse the process, use the Base64 encoder. For encoded image data, Base64 to Image may be more useful than viewing raw binary as text.

Example result produced by the Base64 decoder tool

Where do you encounter Base64 in practice?

You often encounter Base64 where binary data has to pass through a text-oriented format. The value may appear by itself or as one part of a larger document.

  • Data URIs embed small images, fonts or other resources in HTML and CSS, often after a prefix such as data:image/png;base64,.
  • JSON payloads sometimes carry files, certificates or cryptographic material as Base64 strings because JSON has no native binary value type.
  • MIME email uses Base64 for attachments and for message parts that cannot travel safely as plain text.
  • Query strings and web tokens may use Base64url to avoid characters with special meanings in URLs.
  • Configuration files and environment variables sometimes contain Base64 because the surrounding system expects printable text.

Encoded-looking internationalised domain names require a different decoder. A domain label beginning with xn-- uses Punycode, not Base64. Passing it to a Base64 decoder will not recover the intended Unicode domain name.

Why does Base64 decoding fail or produce gibberish?

Base64 decoding usually fails or produces unreadable output because the input uses the wrong variant, is incomplete, has been encoded twice or represents binary data rather than text.

  • Wrong alphabet occurs when Base64url input containing - or _ is treated as standard Base64, or the reverse.
  • Missing or damaged padding can leave an incomplete final block. Some decoders accept omitted padding, but a character count with a remainder of one after division by four cannot form valid Base64.
  • Double encoding produces another Base64-looking string after the first pass. A second decode may be required if the source deliberately encoded the data twice.
  • Binary output is expected for images, PDFs, compressed archives and encrypted bytes. Opening those bytes as text produces symbols or replacement characters.
  • Wrong text encoding causes valid decoded bytes to display incorrectly. UTF-8 data interpreted as Windows-1252, for example, can turn accented characters into mojibake.
  • Extra surrounding content may include a data URI prefix, quotation marks, a JSON escape or URL percent-encoding that should be removed first.

PHP's default base64_decode mode is non-strict and can discard characters outside the standard alphabet. This may allow line breaks from MIME-formatted input, but it can also hide a copying error instead of reporting it clearly. Compare unexpected output with the source format and check the original value character by character.

Frequently asked questions

Is Base64 case-sensitive?

Yes. Uppercase and lowercase letters represent different values in the Base64 alphabet. Changing the case to make a value look consistent will corrupt the decoded bytes.

Can I decode a JWT with a Base64 decoder?

A JSON Web Token normally contains Base64url-encoded sections separated by full stops. Each section must be handled separately, and omitted padding may need to be restored. Reading the payload does not verify the token's signature or prove that its contents are genuine.

Can decoded Base64 contain a virus or malicious file?

Yes, because Base64 can represent any bytes, including executable files, scripts or malicious documents. Decoding does not run the content by itself, but saving or opening an unknown result may be unsafe. Check the expected file type and source before handling binary output.

Why are there null characters in the decoded result?

Null bytes can appear in binary formats and in text encoded as UTF-16, where many Latin characters are paired with a zero byte. If the source claims to be text, check its character encoding rather than deleting the nulls, as removing them can damage the data.

Does Base64 have a fixed file extension?

No. Base64 is a representation, not a file format, so it has no required extension. The decoded bytes determine whether the result is a PNG, PDF, ZIP archive, text file or something else.

Final checks

Confirm that you have copied only the encoded value, identify whether it uses standard Base64 or Base64url, and retain the original capitalisation. If the result is unreadable, check whether it should be opened as a file rather than displayed as text. Do not assume that a successfully decoded value is trustworthy or confidential.

Similar Tools

Base64 encoder

Encode any string to Base64 format with our Base64 encoder tool for secure data encoding.

4,931
41

Popular Tools