Base64 encoding and decoding
Table of Contents
How to do base64 encoding?
Using Javascript
How to encode?
- Use chrome
- Go to
More tools
->Developer tools
-> Consoleconsole.log(btoa("string that needs to be encoded"))
- Grab the encoded value from the output.
How to decode?
atob()
Reading material:
- https://developer.mozilla.org/en-US/docs/Web/API/atob
- https://developer.mozilla.org/en-US/docs/Web/API/btoa
Using terminal in Linux
(This method seems to be including some additional text after the base64 encoded string. Use the chrome method.)
How to encode?
$ echo 'text that needs to be encoded' > file.txt
$ base64 file.txt
How to decode?
echo 'encodedTxthjggyjhkhkhk' | base64 -d