3.6 base64: Transform data into printable data

base64 transforms data read from a file, or standard input, into (or from) base64 encoded form. The base64 encoded form uses printable ASCII characters to represent binary data. Synopses:

base64 [option]… [file]
base64 --decode [option]… [file]

Example#1: Encoding text data

$ echo  '' | base64

Example#2: Decoding text data

$ echo 'bGludXhoaW50LmNvbQo=' | base64 --decode

Example#3: Encoding text file

$ base64 sample.txt
$ base64 sample.txt > encodedData.txt
$ cat encodedData.txt

Example#4: Decoding text file

$ base64 -d encodedData.txt
$ base64 --decode encodedData.txt > originalData.txt
$ cat originalData.txt