On both systems you can use the base64
command.
Example:
cat test.svg | base64
to encode and
echo "<base64>" | base64 -d
and replace -d
with -D
on macOS.
The base64
utility comes preinstalled on most Linux distros as well as macOS.
Source: https://scottlinux.com/2012/09/01/encode-or-decode-base64-from-the-command-line/