TIL: To/From Base64

Base64 encode file in terminal:

1
base64 -i <in-file> -o <outfile>

Base64 encode input string in terminal:

1
2
# -n prevents adding line feed to the end of the string
echo -n 'input string' | base64

Decode base64 string:

1
2
# -n prevents adding line feed to the end of the string
echo -n 'InputBase64String' | base64 --decode

<- Back to all TILs