Base64 turns text or files into plain ASCII so they can travel through places that only accept text, like JSON, email or a URL. macOS has a tool for it built in.
Text, in Terminal
Encode:
echo -n 'hello world' | base64
The -n matters: without it, echo adds a newline that ends up in the result.
Decode:
echo 'aGVsbG8gd29ybGQ=' | base64 -D
Files, in Terminal
base64 -i photo.png -o photo.txt
base64 -D -i photo.txt -o photo-copy.png
The clipboard
pbpaste | base64 | pbcopy
pbpaste | base64 -D | pbcopy
From the notch
NotchMind, which I make, has Base64 encode and Base64 decode on its Developer Tools page in the notch. Paste, press the arrow, and copy the result. It handles UTF-8 text, so accented letters and emoji round-trip correctly, and it runs on your Mac. See developer tools in the notch.
Base64 isn’t encryption
Anyone can decode it. Don’t use it to hide passwords or keys.
NotchMind