Why valid Base64 binary data can fail a text decoder
Base64 can represent any bytes, but the text decoder on this site must turn them into UTF-8 text. A value such as /w== is well formed Base64, and the byte it holds is not text.
Two separate questions
When a decode fails, it helps to ask which layer failed. The first layer is the Base64 representation: does the string use the right alphabet, the right padding and canonical final bits. The second layer is the meaning of the resulting bytes: do they form text in a specific encoding. The text decoder here needs both to pass because it returns a string. A string that passes the first and fails the second is valid Base64 for a binary payload. The rejection is correct for a text tool, and it tells you that you are probably holding binary data, such as an image, a key or a compressed block, and not a message.
Why /w== is one byte, FF
The string /w== has two characters of data and two equals signs. The slash has the alphabet value 63, which is 111111, and w has the value 48, which is 110000. Together the twelve bits are 111111110000. The first eight bits are 11111111, the byte FF, hexadecimal for 255. The remaining four bits are zero, so the padding is canonical. The decoder therefore recovers a single byte with every bit set. The first case enters this value and the tool rejects it with a message that the result is not valid UTF-8, showing that the failure arises after Base64 decoding has already succeeded.
Why FF cannot be text
UTF-8 gives every byte a role. A byte from 00 to 7F stands for itself as an ASCII character. Bytes from C2 to DF start a two-byte sequence, E0 to EF start a three-byte sequence, and F0 to F4 start a four-byte sequence. Bytes 80 to BF are continuation bytes that can only follow a starting byte. The values C0, C1 and F5 to FF never occur in valid UTF-8. The byte FF is therefore invalid anywhere in a text, which is why even a one-byte payload fails. RFC 3629 gives the table of allowed sequences, and a strict decoder rejects anything outside it instead of substituting a replacement character.
The text character that looks close: ÿ
The letter ÿ, small y with diaeresis, has the code point U+00FF. People sometimes assume that its single value FF means it will encode to the same Base64 as the byte FF. UTF-8 does not store it as FF. It stores code points from U+0080 to U+07FF in two bytes, here C3 BF. Encoding ÿ with the Base64 tool returns w78=, as the second case shows. This is a different string from /w==, which represents the single raw byte. The two share a number, 255, but one is a code point in a text and the other is a byte in a binary payload. Mixing them up is a common source of confusion with Latin-1 data.
Computing w78= by hand
The two bytes C3 and BF are 11000011 and 10111111. The sixteen bits cut into six-bit pieces give 110000, 111011, 1111 followed by 00, so 110000, 111011 and 111100. The decimal values are 48, 59 and 60, which are the characters w, 7 and 8 in the standard alphabet. A single equals sign completes the four-character group, and the result is w78=. Decoding reverses the steps, and the third case returns ÿ. At every stage the bytes and the text agree, and both layers pass. That is the difference between this value and the one that was rejected.
What to do with a binary payload
If the value is binary, do not change it to make a text decoder accept it. Inserting characters or replacing bytes alters the data, and an image, an archive or a cryptographic key will no longer work. Use a tool that decodes Base64 into bytes or writes a file, such as a command-line utility or a library function in your language that returns a byte array. Text tools like this one are intended for payloads that you know hold UTF-8 text, such as a JSON document, a name or a message. When you do not know what the payload is, look at the system that produced it for a content type.
Signals that a payload is probably binary
Several signs suggest a binary payload before you decode anything. Long values that start with certain patterns are recognizable: a string beginning with iVBORw0KGgo is typically a PNG image, and one beginning with /9j/ is typically a JPEG image. A value attached to a field described as a key, a signature, a hash or a file is usually binary too. The data URI prefix data:image/png;base64, names the content type outright. A short value like /w== has no such signs, so rely on the source description and on whether the decoder complains about UTF-8.
Another example: the byte 80
The single byte 80, which is 10000000, encodes to gA==. The letter g has the value 32, which is 100000, and A is 0. Together the twelve bits are 100000000000. The first eight are 10000000, the byte 80, and the last four are zero. This byte is a continuation byte in UTF-8, so it can only appear after a starting byte and never at the start of a text. Decoding gA== in the text tool is therefore rejected just like /w==, with the same layer-two explanation. Two different single bytes, FF and 80, are both unusable as text on their own for different reasons, and both are ordinary values in binary files.
Limits of the text tool
This decoder checks the Base64 layer strictly and then requires valid UTF-8. It does not guess at another character encoding, and it does not return raw bytes. The guide uses single bytes to keep the arithmetic visible, but the same rule applies to longer payloads, where a single invalid sequence anywhere causes a rejection. A rejection says that the bytes are not UTF-8 text. It does not say that the Base64 is damaged, and it does not say the data is useless: it may simply need a decoder for bytes. Some libraries decode invalid sequences leniently and insert the replacement character U+FFFD for each bad byte. That behavior hides the problem and corrupts the data, so a tool that refuses is giving you more reliable information. If you see the replacement character, a question mark in a diamond, in decoded output, the bytes were not UTF-8 and the original information is already lost.
Reproduce the checks
Binary byte rejected as text
Open the Base64 Encoder Decoder and enter:
- Calculation mode
decode- Text or encoded input
/w==
Expected rejection:
not valid UTF-8The rejection occurs at the UTF-8 text layer.
Encode the text character
Open the Base64 Encoder Decoder and enter:
- Calculation mode
encode- Text or encoded input
ÿ
Expected output:
Text
w78=The character supplies two UTF-8 bytes.
Decode the text representation
Open the Base64 Encoder Decoder and enter:
- Calculation mode
decode- Text or encoded input
w78=
Expected output:
Text
ÿThis sequence satisfies both decoding layers.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08