Is a space possible in a base64 encoding?

I was receiving a base64 string with a space, but my decoder was just ignoring the space. Unfortunately ignoring the space was not providing the expected value.

The space (" ") had to be replaced with a "+" in order for my decoder output the correct value.


No. Next question?

http://en.wikipedia.org/wiki/Base64#Variants_summary_table

Actually, spaces and CRLFs are usually silently skipped during the decoding, as they might appear as a result of splitting long strings.


By reading the http://en.wikipedia.org/wiki/Base64 wiki it seems that in Base64 transfer encoding for MIME (RFC 2045) spaces are allowed and discarded. In all other variants they are forbidden. Ah... and this question is a duplicate: Can a base64 encoded string contain whitespace?


Base64 encoding output will never include a space. FooBabel has a nice (free) online encoding tool based on Apache Codec, where you can play with options like linebreaks and line terminators - foobabel base64 codec