Base64 Encoding There are two easy ways to base64 encode a string. You can use b64encode: $ b64encode randomname begin-base64 644 test randomstring cmFuZG9tc3RyaW5n Or you can use this perl one-liner: perl -MMIME::Base64 -e 'print encode_base64("randomstring");' cmFuZG9tc3RyaW5n To decode a base64 string, you can use b64decode: