

The following command will decode the encoded text and save the original text in a file called " Decoded file. We will also be able to save decoded output to file, rather than printing to standard output. This command will print the original text to standard output as shown in the above screenshot. To decode base64 encoded text ' 4oCcdGV4dG8gZGUgZWplbXBsb + KAnQo =', the command would be:Įcho “4oCcdGV4dG8gZGUgZWplbXBsb+KAnQo=” | base64 -decode We can decode base64 encoded text using –decode or -d option. The following command will encode the text and save the output to a file called " encodedfile.txt«:Įcho “texto de ejemplo” | base64 > archivoCodificado.txtįor, view the content of the encoded file, we can use the command cat, as you can see in the previous capture. We can also save the encoded output to a file, instead of printing it to standard output.

This command will encode the text in the string using base64 and print the encoded text to standard output. Users can encode a string with base64 command.
BASE64 ENCODING FROM COMMAND LINE HOW TO
In the following lines we will see how to use base64 command to encode and decode data in string or file. Some of the uses of encryption are compressing data, hiding data, or transmitting data in another format. All the famous variants that go by the name Base64 use the character range AZ, az and 0-9 in this order for the first 62 digits, but the symbols chosen for the last two digits vary considerably from one to the other. This has led to its use for email encryption, PGP, and other applications. It is the highest power that can be represented using only printable ASCII characters. As a result, information is lost or corrupted during transmission.īase 64 is a positional numbering system that uses 64 as the base. Base64 is the encoding process where binary data is converted to ASCII.īase64 encoding is mainly used to avoid transmission problems, which occur when binary data is transmitted to text-based systems that cannot handle this binary data correctly.

In contrast, decoding is the opposite of the encoding method that converts the encoded data to its original format. Encoding is the process used to convert data into a format required for effective transmission or storage. In the next article we are going to take a look at how can we encode and decode from the terminal with base64.
