Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Created May 16, 2015 09:24
Show Gist options
  • Select an option

  • Save githubutilities/c818ef93b1a792a4efe7 to your computer and use it in GitHub Desktop.

Select an option

Save githubutilities/c818ef93b1a792a4efe7 to your computer and use it in GitHub Desktop.
Base64 in Command Line

Base64 in Command Line

Using base64

# encode
base64 <<< 'hello'

# decode
base64 -decode <<< `base64 <<< 'hello'`
# or
base64 -D <<< 'aGVsbG8K'
# or with new line char
echo `echo aGVsbG8K | base64 --decode`

Using openssl

# encode
openssl base64 -e <<< 'hello'
# or
openssl enc -base64 <<< 'hello'

# decode
openssl base64 -d <<< 'aGVsbG8K'
# or
openssl enc -base64 -d <<< `aGVsbG8K`

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment