[Shell command] Encode and decode Base64 text

Created on November 30, 2026

You can pipe text to base64 to encode it. This example includes a newline after Hello World.

printf 'Hello World\n' | base64
SGVsbG8gV29ybGQK

Use base64 -d with GNU Coreutils to decode the result. The decoded text includes the original newline.

printf '%s\n' 'SGVsbG8gV29ybGQK' | base64 -d
Hello World
Shell command