Cogs and Levers A blog full of technical stuff

Encode or Decode base64 at the console

Today’s post is a quick tip on encoding and decoding base64 information with the base64 command at the linux prompt.

In order to encode a piece of text, you can do the following:

$ echo 'I want to encode this text' | base64
SSB3YW50IHRvIGVuY29kZSB0aGlzIHRleHQK

To reverse the process, simply use the -d switch:

$ echo SSB3YW50IHRvIGVuY29kZSB0aGlzIHRleHQK | base64 -d
I want to encode this text

Simple.