# ASCII invariant string for base64 Encoding

I know the basics about base64 encoding, but thinking about it abstractly I have a theoretical question.

If we consider base64 a mathematical function(in our case computable), Does there exists an invariant for base64-encoding function ? It only make sense or to narrow down the scope of the question I assume input binary is ASCII string.

For given ASCII string we can convert it to base64 encoded string in following way

user@machine\$ echo "Many hands make light work." | base64
TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsuCg==


How can I find a ASCII string whose base64 representation is same as its input, if it exists ?

Is there any way to prove it's non-existence ?

• Isn't it obvious that coding 6 bits in a single byte will make a longer string ? Even if you assume that the two leading bits are zeroes, there is no matching between single ASCII characters up to 64 and their Base64 encoding.
– user16034
Commented Mar 18, 2023 at 10:09
• Slightly more interesting would be: Is there a sequence of bytes that is a prefix of its base-64 encoding? Or: What is the largest possible common prefix of a sequence of bytes and its base-64 encoding? Commented Mar 22, 2023 at 21:57

• @MaartenBodewes nope: echo "" | base64 yields Cg==.
• @Kai Yes, and echo -n "" | base64 yields? Commented Mar 20, 2023 at 7:57
• Indeed! My bad. So base64 does have a fixpoint.