I use base64 encoding when I need to pass binary data or special characters through a system that only handles plain text — things like embedding credentials in config, encoding cert content for environment variables, or testing endpoints that expect base64 payloads. The file encoding examples are useful for scripting.
1
2
| $ echo "bla" | base64
YmxhCg==
|
1
2
| $ echo "YmxhCg==" | base64 -d
bla
|
1
2
3
4
5
| $ touch test
$ echo "hello" > test
$ cat test | base64 > encodedtest
|
1
2
| $ cat encodedtest | base64 -d
hello
|