Every OS has a built-in way to decode Base64 from the terminal. The syntax is slightly different on each. Here is the exact command for every platform, plus a browser alternative when you do not want to open a terminal.
The base64 command is pre-installed on every major distro.
echo "SGVsbG8gV29ybGQ=" | base64 -dbase64 -d encoded.txt > decoded.txtecho -n "Hello World" | base64base64 input.txt > encoded.txtThe -n flag on echo is important when encoding. Without it, echo adds a trailing newline that gets included in the Base64 output.
macOS uses the BSD version of base64. The critical difference: use -D (capital) for decode, not -d.
echo "SGVsbG8=" | base64 -Decho -n "Hello" | base64base64 -D -i encoded.txt -o decoded.txtIf you use Homebrew and install coreutils, you get gbase64 which uses the same flags as Linux (-d for decode).
Windows does not have a simple base64 command.
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("SGVsbG8="))[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("Hello"))Verbose, but it works. PowerShell 5+ is pre-installed on Windows 10 and 11.
certutil -decode encoded.txt decoded.txtcertutil -encode input.txt encoded.txtOnly works with files, not inline strings. And the output includes a certificate header/footer that you may need to strip.
| Platform | Decode Command | Gotcha |
|---|---|---|
| Linux | echo "..." | base64 -d | Use -n on echo when encoding |
| macOS | echo "..." | base64 -D | Capital -D, not lowercase -d |
| PowerShell | [Convert]::FromBase64String(...) | Verbose syntax |
| CMD | certutil -decode file.txt out.txt | Files only, adds headers |
| Python | base64.b64decode("...").decode() | Works everywhere Python runs |
| Browser | Paste and click Decode | No syntax to remember |
If you need to quickly decode one string while reading documentation, debugging an API response, or checking a Kubernetes secret, opening a terminal and typing a command is slower than opening a browser tab.
The Base64 Encoder/Decoder handles both encoding and decoding with one click. No syntax differences between platforms, no flags to remember, full UTF-8 support built in.
Skip the terminal. Decode Base64 in one click.
Open Decoder →For scripts and CI/CD pipelines, the command-line tools are the right choice. Some tips:
echo -n (no trailing newline) when encodingkubectl get secret name -o jsonpath='{.data.key}' | base64 -dRelated: URL Encoder for percent-encoding, JSON Formatter for API debugging.