Origin Data
'{"foo":"bar"}'
Encode
Shell
echo -n '{"foo":"bar"}' | base64
# eyJmb28iOiJiYXIifQ==
Browser
btoa('{"foo":"bar"}');
// eyJmb28iOiJiYXIifQ==
Nodejs
Buffer.from('{"foo":"bar"}').toString('base64');
// 'eyJmb28iOiJiYXIifQ=='
Python
import base64
base64.b64encode(bytes('{"foo":"bar"}', 'utf-8'))
# b'eyJmb28iOiJiYXIifQ=='
Decode
Shell
echo -n 'eyJmb28iOiJiYXIifQ==' | base64 -d
# {"foo":"bar"}%
Browser
atob('eyJmb28iOiJiYXIifQ==');
// {"foo":"bar"}
Nodejs
Buffer.from('eyJmb28iOiJiYXIifQ==', 'base64').toString();
// '{"foo":"bar"}'
Python
base64.b64decode('eyJmb28iOiJiYXIifQ==')
# b'{"foo":"bar"}'