I have some data that is base64 encoded that I want to convert back to binary even if there is a padding error in it. If I use base64.decodestring(b64_string) it raises an 'Incorrect padding' error. Is there another way? UPDATE: Thanks for all the feedback. To be honest, all the methods mentioned sounded a bit hit and miss so I decided to try openssl. The following command worked a treat: openssl enc -d -base64 -in b64string -out binary_data Continue reading...