Skip to main content

How can I decode a base64 string from the command line?








If you have ever needed to quickly decode or encode base64, Linux has a command line utility called base64 that works great. I’ll show you how it works!

To encode text to base64, use the following syntax:
$ echo -n 'devilzlinux.blogspot.com' | base64
ZGV2aWx6bGludXguYmxvZ3Nwb3QuY29tCg==


To decode, use base64 -d. To decode base64, use a syntax like the following:
$ echo -n  ZGV2aWx6bGludXguYmxvZ3Nwb3QuY29tCg== | base64 -d
devilzlinux.blogspot.com
Note: if on OS X, use capital D:
echo -n ZGV2aWx6bGludXguYmxvZ3Nwb3QuY29tCg== | base64 -D


same work with another way

python

___________________________________________________________
python -m base64 -d <<< "ZGV2aWx6bGludXguYmxvZ3Nwb3QuY29tCg=="
devilzlinux.blogspot.com 
____________________________________________________________________

perl

_____________________________________________________________
perl -MMIME::Base64 -ne 'printf "%s\n",decode_base64($_)' <<< "ZGV2aWx6bGludXguYmx
vZ3Nwb3QuY29tCg=="
devilzlinux.blogspot.com 
_____________________________________________________________

openssl

______________________________________________________

openssl base64 -e <<< 'Welcome to openssl wiki'

 V2VsY29tZSB0byBvcGVuc3NsIHdpa2kK



openssl base64 -d <<< 'V2VsY29tZSB0byBvcGVuc3NsIHdpa2kK'

Welcome to openssl wiki
_______________________________________________________________