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 'scottlinux.com rocks' | base64 c2NvdHRsaW51eC5jb20gcm9ja3MK
To decode, use base64 -d. To decode base64, use a syntax like the following:
$ echo c2NvdHRsaW51eC5jb20gcm9ja3MK | base64 -d scottlinux.com rocks
Note: if on OS X, use capital D:
echo c2NvdHRsaW51eC5jb20gcm9ja3MK | base64 -D
Cool!



use “echo -n” to prevent the newline from echo being encoded in the result as well.
echo -n “blah” | base64